aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog6
-rw-r--r--src/unexmacosx.c38
2 files changed, 36 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c76bdd80caa..faa02a11786 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12007-10-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * unexmacosx.c (unexec_regions_recorder, unexec_regions_merge):
4 Don't assume regions are aligned to page boundary.
5 (print_load_command_name): Add LC_UUID if defined.
6
12007-10-30 Richard Stallman <rms@gnu.org> 72007-10-30 Richard Stallman <rms@gnu.org>
2 8
3 * emacs.c (syms_of_emacs) <installation-directory>: Reflow docstring. 9 * emacs.c (syms_of_emacs) <installation-directory>: Reflow docstring.
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,
443 443
444 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS) 444 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
445 { 445 {
446 /* Subtract the size of trailing null pages from filesize. It 446 /* Subtract the size of trailing null bytes from filesize. It
447 can be smaller than vmsize in segment commands. In such a 447 can be smaller than vmsize in segment commands. In such a
448 case, trailing pages are initialized with zeros. */ 448 case, trailing bytes are initialized with zeros. */
449 for (p = ranges->address + ranges->size; p > ranges->address; 449 for (p = ranges->address + ranges->size; p > ranges->address; p--)
450 p -= sizeof (int)) 450 if (*(((char *) p)-1))
451 if (*(((int *) p)-1)) 451 break;
452 break; 452 filesize = p - ranges->address;
453 filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address);
454 assert (filesize <= ranges->size);
455 453
456 unexec_regions[num_unexec_regions].filesize = filesize; 454 unexec_regions[num_unexec_regions].filesize = filesize;
457 unexec_regions[num_unexec_regions++].range = *ranges; 455 unexec_regions[num_unexec_regions++].range = *ranges;
@@ -503,11 +501,19 @@ unexec_regions_merge ()
503{ 501{
504 int i, n; 502 int i, n;
505 unexec_region_info r; 503 unexec_region_info r;
504 vm_size_t padsize;
506 505
507 qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]), 506 qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]),
508 &unexec_regions_sort_compare); 507 &unexec_regions_sort_compare);
509 n = 0; 508 n = 0;
510 r = unexec_regions[0]; 509 r = unexec_regions[0];
510 padsize = r.range.address & (pagesize - 1);
511 if (padsize)
512 {
513 r.range.address -= padsize;
514 r.range.size += padsize;
515 r.filesize += padsize;
516 }
511 for (i = 1; i < num_unexec_regions; i++) 517 for (i = 1; i < num_unexec_regions; i++)
512 { 518 {
513 if (r.range.address + r.range.size == unexec_regions[i].range.address 519 if (r.range.address + r.range.size == unexec_regions[i].range.address
@@ -520,6 +526,17 @@ unexec_regions_merge ()
520 { 526 {
521 unexec_regions[n++] = r; 527 unexec_regions[n++] = r;
522 r = unexec_regions[i]; 528 r = unexec_regions[i];
529 padsize = r.range.address & (pagesize - 1);
530 if (padsize)
531 {
532 if ((unexec_regions[n-1].range.address
533 + unexec_regions[n-1].range.size) == r.range.address)
534 unexec_regions[n-1].range.size -= padsize;
535
536 r.range.address -= padsize;
537 r.range.size += padsize;
538 r.filesize += padsize;
539 }
523 } 540 }
524 } 541 }
525 unexec_regions[n++] = r; 542 unexec_regions[n++] = r;
@@ -562,6 +579,11 @@ print_load_command_name (int lc)
562 case LC_TWOLEVEL_HINTS: 579 case LC_TWOLEVEL_HINTS:
563 printf ("LC_TWOLEVEL_HINTS"); 580 printf ("LC_TWOLEVEL_HINTS");
564 break; 581 break;
582#ifdef LC_UUID
583 case LC_UUID:
584 printf ("LC_UUID ");
585 break;
586#endif
565 default: 587 default:
566 printf ("unknown "); 588 printf ("unknown ");
567 } 589 }