| 1 | *** src/unexmacosx.c 25 Jul 2007 05:15:30 -0000 1.22.2.1 |
|---|
| 2 | --- src/unexmacosx.c 29 Oct 2007 23:09:00 -0000 |
|---|
| 3 | *************** unexec_regions_recorder (task_t task, vo |
|---|
| 4 | *** 443,457 **** |
|---|
| 5 | |
|---|
| 6 | while (num && num_unexec_regions < MAX_UNEXEC_REGIONS) |
|---|
| 7 | { |
|---|
| 8 | ! /* Subtract the size of trailing null pages from filesize. It |
|---|
| 9 | can be smaller than vmsize in segment commands. In such a |
|---|
| 10 | ! case, trailing pages are initialized with zeros. */ |
|---|
| 11 | ! for (p = ranges->address + ranges->size; p > ranges->address; |
|---|
| 12 | ! p -= sizeof (int)) |
|---|
| 13 | ! if (*(((int *) p)-1)) |
|---|
| 14 | ! break; |
|---|
| 15 | ! filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address); |
|---|
| 16 | ! assert (filesize <= ranges->size); |
|---|
| 17 | |
|---|
| 18 | unexec_regions[num_unexec_regions].filesize = filesize; |
|---|
| 19 | unexec_regions[num_unexec_regions++].range = *ranges; |
|---|
| 20 | --- 443,455 ---- |
|---|
| 21 | |
|---|
| 22 | while (num && num_unexec_regions < MAX_UNEXEC_REGIONS) |
|---|
| 23 | { |
|---|
| 24 | ! /* Subtract the size of trailing null bytes from filesize. It |
|---|
| 25 | can be smaller than vmsize in segment commands. In such a |
|---|
| 26 | ! case, trailing bytes are initialized with zeros. */ |
|---|
| 27 | ! for (p = ranges->address + ranges->size; p > ranges->address; p--) |
|---|
| 28 | ! if (*(((char *) p)-1)) |
|---|
| 29 | ! break; |
|---|
| 30 | ! filesize = p - ranges->address; |
|---|
| 31 | |
|---|
| 32 | unexec_regions[num_unexec_regions].filesize = filesize; |
|---|
| 33 | unexec_regions[num_unexec_regions++].range = *ranges; |
|---|
| 34 | *************** unexec_regions_merge () |
|---|
| 35 | *** 503,513 **** |
|---|
| 36 | --- 501,519 ---- |
|---|
| 37 | { |
|---|
| 38 | int i, n; |
|---|
| 39 | unexec_region_info r; |
|---|
| 40 | + vm_size_t padsize; |
|---|
| 41 | |
|---|
| 42 | qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]), |
|---|
| 43 | &unexec_regions_sort_compare); |
|---|
| 44 | n = 0; |
|---|
| 45 | r = unexec_regions[0]; |
|---|
| 46 | + padsize = r.range.address & (pagesize - 1); |
|---|
| 47 | + if (padsize) |
|---|
| 48 | + { |
|---|
| 49 | + r.range.address -= padsize; |
|---|
| 50 | + r.range.size += padsize; |
|---|
| 51 | + r.filesize += padsize; |
|---|
| 52 | + } |
|---|
| 53 | for (i = 1; i < num_unexec_regions; i++) |
|---|
| 54 | { |
|---|
| 55 | if (r.range.address + r.range.size == unexec_regions[i].range.address |
|---|
| 56 | *************** unexec_regions_merge () |
|---|
| 57 | *** 520,525 **** |
|---|
| 58 | --- 526,542 ---- |
|---|
| 59 | { |
|---|
| 60 | unexec_regions[n++] = r; |
|---|
| 61 | r = unexec_regions[i]; |
|---|
| 62 | + padsize = r.range.address & (pagesize - 1); |
|---|
| 63 | + if (padsize) |
|---|
| 64 | + { |
|---|
| 65 | + if ((unexec_regions[n-1].range.address |
|---|
| 66 | + + unexec_regions[n-1].range.size) == r.range.address) |
|---|
| 67 | + unexec_regions[n-1].range.size -= padsize; |
|---|
| 68 | + |
|---|
| 69 | + r.range.address -= padsize; |
|---|
| 70 | + r.range.size += padsize; |
|---|
| 71 | + r.filesize += padsize; |
|---|
| 72 | + } |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | unexec_regions[n++] = r; |
|---|
| 76 | *************** print_load_command_name (int lc) |
|---|
| 77 | *** 562,567 **** |
|---|
| 78 | --- 579,589 ---- |
|---|
| 79 | case LC_TWOLEVEL_HINTS: |
|---|
| 80 | printf ("LC_TWOLEVEL_HINTS"); |
|---|
| 81 | break; |
|---|
| 82 | + #ifdef LC_UUID |
|---|
| 83 | + case LC_UUID: |
|---|
| 84 | + printf ("LC_UUID "); |
|---|
| 85 | + break; |
|---|
| 86 | + #endif |
|---|
| 87 | default: |
|---|
| 88 | printf ("unknown "); |
|---|
| 89 | } |
|---|