Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
--- emacs-22.1.orig/src/unexmacosx.c 2007-01-20 21:18:15.000000000 -0700
+++ emacs-22.1/src/unexmacosx.c 2007-10-31 10:32:19.000000000 -0600
@@ -448,10 +448,9 @@
case, trailing pages are initialized with zeros. */
for (p = ranges->address + ranges->size; p > ranges->address;
p -= sizeof (int))
- if (*(((int *) p)-1))
+ if (*(((char *) p)-1))
break;
- filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address);
- assert (filesize <= ranges->size);
+ filesize = p - ranges->address;
unexec_regions[num_unexec_regions].filesize = filesize;
unexec_regions[num_unexec_regions++].range = *ranges;
@@ -503,11 +502,20 @@
{
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 +528,17 @@
{
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 +581,11 @@
case LC_TWOLEVEL_HINTS:
printf ("LC_TWOLEVEL_HINTS");
break;
+#ifdef LC_UUID
+ case LC_UUID:
+ printf ("LC_UUID ");
+ break;
+#endif
default:
printf ("unknown ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.