emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/unexmacosx.c,v [EMACS_22_BASE]


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] Changes to emacs/src/unexmacosx.c,v [EMACS_22_BASE]
Date: Tue, 30 Oct 2007 08:32:16 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     YAMAMOTO Mitsuharu <mituharu>   07/10/30 08:32:15

Index: unexmacosx.c
===================================================================
RCS file: /sources/emacs/emacs/src/unexmacosx.c,v
retrieving revision 1.22.2.1
retrieving revision 1.22.2.2
diff -u -b -r1.22.2.1 -r1.22.2.2
--- unexmacosx.c        25 Jul 2007 05:15:30 -0000      1.22.2.1
+++ unexmacosx.c        30 Oct 2007 08:32:15 -0000      1.22.2.2
@@ -443,15 +443,13 @@
 
   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))
+        case, trailing bytes are initialized with zeros.  */
+      for (p = ranges->address + ranges->size; p > ranges->address; p--)
+       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 +501,19 @@
 {
   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[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 @@
     case LC_TWOLEVEL_HINTS:
       printf ("LC_TWOLEVEL_HINTS");
       break;
+#ifdef LC_UUID
+    case LC_UUID:
+      printf ("LC_UUID          ");
+      break;
+#endif
     default:
       printf ("unknown          ");
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]