summaryrefslogtreecommitdiff
path: root/src/unexmacosx.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-11-11 00:56:44 +0000
committerMiles Bader <miles@gnu.org>2007-11-11 00:56:44 +0000
commitf23d76bdefbd4c06e14d69e99e50d35ce91c8226 (patch)
treeded28d1da6df2d0135514bac83074f4ca1c9099a /src/unexmacosx.c
parente2d092da5980a7d05a5428074f8eb4925fa801e8 (diff)
parenta457417ee5ba797ab1c91d35ee957bb7a7f8d4b6 (diff)
downloademacs-f23d76bdefbd4c06e14d69e99e50d35ce91c8226.tar.gz
emacs-f23d76bdefbd4c06e14d69e99e50d35ce91c8226.tar.bz2
emacs-f23d76bdefbd4c06e14d69e99e50d35ce91c8226.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-283
Diffstat (limited to 'src/unexmacosx.c')
-rw-r--r--src/unexmacosx.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index e9664f94bbc..3646aec6983 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -443,15 +443,13 @@ unexec_regions_recorder (task_t task, void *rr, unsigned type,
while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
{
- /* Subtract the size of trailing null pages from filesize. It
+ /* Subtract the size of trailing null bytes from filesize. It
can be smaller than vmsize in segment commands. In such a
- case, trailing pages are initialized with zeros. */
- for (p = ranges->address + ranges->size; p > ranges->address;
- p -= sizeof (int))
- if (*(((int *) p)-1))
- break;
- filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address);
- assert (filesize <= ranges->size);
+ case, trailing bytes are initialized with zeros. */
+ for (p = ranges->address + ranges->size; p > ranges->address; p--)
+ if (*(((char *) p)-1))
+ break;
+ filesize = p - ranges->address;
unexec_regions[num_unexec_regions].filesize = filesize;
unexec_regions[num_unexec_regions++].range = *ranges;
@@ -503,11 +501,19 @@ unexec_regions_merge ()
{
int i, n;
unexec_region_info r;
+ vm_size_t padsize;
qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]),
&unexec_regions_sort_compare);
n = 0;
r = unexec_regions[0];
+ padsize = r.range.address & (pagesize - 1);
+ if (padsize)
+ {
+ r.range.address -= padsize;
+ r.range.size += padsize;
+ r.filesize += padsize;
+ }
for (i = 1; i < num_unexec_regions; i++)
{
if (r.range.address + r.range.size == unexec_regions[i].range.address
@@ -520,6 +526,17 @@ unexec_regions_merge ()
{
unexec_regions[n++] = r;
r = unexec_regions[i];
+ padsize = r.range.address & (pagesize - 1);
+ if (padsize)
+ {
+ if ((unexec_regions[n-1].range.address
+ + unexec_regions[n-1].range.size) == r.range.address)
+ unexec_regions[n-1].range.size -= padsize;
+
+ r.range.address -= padsize;
+ r.range.size += padsize;
+ r.filesize += padsize;
+ }
}
}
unexec_regions[n++] = r;
@@ -562,6 +579,11 @@ print_load_command_name (int lc)
case LC_TWOLEVEL_HINTS:
printf ("LC_TWOLEVEL_HINTS");
break;
+#ifdef LC_UUID
+ case LC_UUID:
+ printf ("LC_UUID ");
+ break;
+#endif
default:
printf ("unknown ");
}