Rev 2977 | Rev 2990 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2977 | Rev 2985 | ||
---|---|---|---|
Line 291... | Line 291... | ||
291 | ); |
291 | ); |
292 | return EE_INVALID; |
292 | return EE_INVALID; |
293 | } |
293 | } |
294 | } |
294 | } |
295 | 295 | ||
296 | /* if (entry->p_flags & PF_X) |
296 | if (entry->p_flags & PF_X) |
297 | flags |= AS_AREA_EXEC; |
297 | flags |= AS_AREA_EXEC; |
298 | if (entry->p_flags & PF_W) |
298 | if (entry->p_flags & PF_W) |
299 | flags |= AS_AREA_WRITE; |
299 | flags |= AS_AREA_WRITE; |
300 | if (entry->p_flags & PF_R) |
300 | if (entry->p_flags & PF_R) |
301 | flags |= AS_AREA_READ; |
301 | flags |= AS_AREA_READ; |
302 | flags |= AS_AREA_CACHEABLE; |
302 | flags |= AS_AREA_CACHEABLE; |
303 | */ |
303 | |
304 | /* FIXME: Kernel won't normally allow this, unless you "patch" it */ |
304 | /* Final flags for the memory area */ |
305 | // flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_EXEC | AS_AREA_CACHEABLE; |
- | |
306 | flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; |
305 | flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; |
307 | 306 | ||
308 | /* |
307 | /* |
309 | * Check if the virtual address starts on page boundary. |
308 | * Check if the virtual address starts on page boundary. |
310 | */ |
309 | */ |
Line 316... | Line 315... | ||
316 | } |
315 | } |
317 | 316 | ||
318 | printf("map to p_vaddr=0x%x-0x%x...\n", entry->p_vaddr + bias, |
317 | printf("map to p_vaddr=0x%x-0x%x...\n", entry->p_vaddr + bias, |
319 | entry->p_vaddr + bias + ALIGN_UP(entry->p_memsz, PAGE_SIZE)); |
318 | entry->p_vaddr + bias + ALIGN_UP(entry->p_memsz, PAGE_SIZE)); |
320 | 319 | ||
- | 320 | /* |
|
- | 321 | * For the course of loading, the area needs to be readable |
|
- | 322 | * and writeable. |
|
- | 323 | */ |
|
321 | a = as_area_create((uint8_t *)entry->p_vaddr + bias, |
324 | a = as_area_create((uint8_t *)entry->p_vaddr + bias, |
322 | entry->p_memsz, flags); |
325 | entry->p_memsz, AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); |
323 | if (a == (void *)(-1)) { |
326 | if (a == (void *)(-1)) { |
324 | printf("memory mapping failed\n"); |
327 | printf("memory mapping failed\n"); |
325 | return EE_MEMORY; |
328 | return EE_MEMORY; |
326 | } |
329 | } |
327 | 330 | ||
Line 353... | Line 356... | ||
353 | printf("->%d\n", rc); |
356 | printf("->%d\n", rc); |
354 | left -= now; |
357 | left -= now; |
355 | dp += now; |
358 | dp += now; |
356 | } |
359 | } |
357 | 360 | ||
- | 361 | printf("set area flags to %d\n", flags); |
|
- | 362 | rc = as_area_change_flags((uint8_t *)entry->p_vaddr + bias, flags); |
|
- | 363 | if (rc != 0) { |
|
- | 364 | printf("failed to set memory area flags\n"); |
|
- | 365 | return EE_MEMORY; |
|
- | 366 | } |
|
- | 367 | ||
358 | return EE_OK; |
368 | return EE_OK; |
359 | } |
369 | } |
360 | 370 | ||
361 | /** Process section header. |
371 | /** Process section header. |
362 | * |
372 | * |