commit-hurd
[Top][All Lists]
Advanced

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

hurd-l4 physmem/Makefile.am physmem/zalloc.c wo...


From: Marcus Brinkmann
Subject: hurd-l4 physmem/Makefile.am physmem/zalloc.c wo...
Date: Fri, 19 Sep 2003 14:33:30 -0400

CVSROOT:        /cvsroot/hurd
Module name:    hurd-l4
Branch:         
Changes by:     Marcus Brinkmann <address@hidden>       03/09/19 14:33:30

Modified files:
        physmem        : Makefile.am zalloc.c 
        wortel         : Makefile.am wortel.c 
Removed files:
        physmem        : getpagesize.c 
        wortel         : getpagesize.c 

Log message:
        wortel/
        2003-09-19  Marcus Brinkmann  <address@hidden>
        
        * Makefile.am (wortel_SOURCES): Remove getpagesize.c.
        * getpagesize.c: File removed.
        * wortel.c (make_fpages): Use l4_min_page_size, not getpagesize().
        (load_components): Likewise.
        (serve_bootstrap_requests): Likewise.
        (MAX_FPAGES): Use L4_MIN_PAGE_SIZE_LOG2 instead
        hard-coded 10.
        (serve_bootstrap_requests): Likewise.
        
        physmem/
        2003-09-19  Marcus Brinkmann  <address@hidden>
        
        * zalloc.c (L4_MIN_PAGE_SHIFT): Remove macro.
        (ZONE_SIZE): Use L4_MIN_PAGE_SIZE_LOG2 instead of L4_MIN_PAGE_SHIFT.
        (ZONES): Likewise.
        (zfree): Likewise.
        (zalloc): Likewise.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/physmem/Makefile.am.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/physmem/zalloc.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/Makefile.am.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/wortel.c.diff?tr1=1.15&tr2=1.16&r1=text&r2=text

Patches:
Index: hurd-l4/physmem/Makefile.am
diff -u hurd-l4/physmem/Makefile.am:1.5 hurd-l4/physmem/Makefile.am:1.6
--- hurd-l4/physmem/Makefile.am:1.5     Thu Sep 18 11:58:00 2003
+++ hurd-l4/physmem/Makefile.am Fri Sep 19 14:33:30 2003
@@ -28,7 +28,6 @@
 
 physmem_SOURCES = $(ARCH_SOURCES)                              \
        output.h output.c                                       \
-       getpagesize.c                                           \
        zalloc.h zalloc.c                                       \
        physmem.h physmem.c
 
Index: hurd-l4/physmem/zalloc.c
diff -u hurd-l4/physmem/zalloc.c:1.4 hurd-l4/physmem/zalloc.c:1.5
--- hurd-l4/physmem/zalloc.c:1.4        Fri Sep 19 13:49:59 2003
+++ hurd-l4/physmem/zalloc.c    Fri Sep 19 14:33:30 2003
@@ -96,13 +96,11 @@
 };
 
 
-#define L4_MIN_PAGE_SHIFT 10
-
 /* Given a zone, return its size.  */
-#define ZONE_SIZE(x) (1 << ((x) + L4_MIN_PAGE_SHIFT))
+#define ZONE_SIZE(x) (1 << ((x) + L4_MIN_PAGE_SIZE_LOG2))
 
 /* Number of zones in the system.  */
-#define ZONES (sizeof (L4_Word_t) * 8 - L4_MIN_PAGE_SHIFT)
+#define ZONES (sizeof (L4_Word_t) * 8 - L4_MIN_PAGE_SIZE_LOG2)
 
 /* The zones.  */
 static struct block *zone[ZONES] = { 0, };
@@ -183,7 +181,7 @@
 void
 zfree (l4_word_t block, l4_word_t size)
 {
-  l4_word_t min_page_size = getpagesize ();
+  l4_word_t min_page_size = l4_min_page_size ();
   
   debug ("%s: freeing block 0x%x - 0x%x\n", __func__,
         block, block + size);
@@ -203,7 +201,7 @@
       unsigned int size_align = l4_msb (size) - 1;
       unsigned int zone_nr = (block_align < size_align
                              ? block_align : size_align)
-       - L4_MIN_PAGE_SHIFT;
+       - L4_MIN_PAGE_SIZE_LOG2;
 
       add_block ((struct block *) block, zone_nr);
 
@@ -220,7 +218,7 @@
 l4_word_t
 zalloc (l4_word_t size)
 {
-  l4_word_t min_page_size = getpagesize ();
+  l4_word_t min_page_size = l4_min_page_size ();
   unsigned int zone_nr;
   struct block *block;
 
@@ -237,7 +235,7 @@
      case where only one bit is set.  To adjust for this border case,
      we subtract one from the argument to the MSB function).  Calculate
      the zone number by subtracting page shift.  */
-  zone_nr = l4_msb (size - 1) - L4_MIN_PAGE_SHIFT;
+  zone_nr = l4_msb (size - 1) - L4_MIN_PAGE_SIZE_LOG2;
 
   /* Find the smallest zone which fits the request and has memory
      available.  */
@@ -271,7 +269,7 @@
 void
 zalloc_dump_zones (const char *prefix)
 {
-  l4_word_t min_page_size = getpagesize ();
+  l4_word_t min_page_size = l4_min_page_size ();
   int i;
   struct block *block;
   l4_word_t available = 0;
Index: hurd-l4/wortel/Makefile.am
diff -u hurd-l4/wortel/Makefile.am:1.8 hurd-l4/wortel/Makefile.am:1.9
--- hurd-l4/wortel/Makefile.am:1.8      Fri Sep 19 13:49:59 2003
+++ hurd-l4/wortel/Makefile.am  Fri Sep 19 14:33:30 2003
@@ -32,7 +32,6 @@
        output.h output.c output-none.c                         \
        shutdown.h shutdown.c                                   \
        elf.h loader.h loader.c                                 \
-       getpagesize.c                                           \
        sigma0.h sigma0.c                                       \
        wortel.h wortel.c
 
Index: hurd-l4/wortel/wortel.c
diff -u hurd-l4/wortel/wortel.c:1.15 hurd-l4/wortel/wortel.c:1.16
--- hurd-l4/wortel/wortel.c:1.15        Fri Sep 19 10:18:04 2003
+++ hurd-l4/wortel/wortel.c     Fri Sep 19 14:33:30 2003
@@ -114,11 +114,11 @@
 /* The maximum number of fpages required to cover a page aligned range
    of memory.  This is k if the maximum memory range size to cover is
    2^(k + min_page_size_log2), which can be easily proved by
-   induction.  The minimum page size in L4 is at least 2^10.  We also
-   need to have each fpage aligned to a multiple of its own size.
-   This makes the proof by induction a bit more convoluted, but does
-   not change the result.  */
-#define MAX_FPAGES (sizeof (l4_word_t) * 8 - 10)
+   induction.  The minimum page size in L4 is at least
+   L4_MIN_PAGE_SIZE.  We also need to have each fpage aligned to a
+   multiple of its own size.  This makes the proof by induction a bit
+   more convoluted, but does not change the result.  */
+#define MAX_FPAGES (sizeof (l4_word_t) * 8 - L4_MIN_PAGE_SIZE_LOG2)
 
 
 /* Determine the fpages required to cover the bytes from START to END
@@ -131,7 +131,7 @@
 static unsigned int
 make_fpages (l4_word_t start, l4_word_t end, l4_fpage_t *fpages)
 {
-  l4_word_t min_page_size = getpagesize ();
+  l4_word_t min_page_size = l4_min_page_size ();
   unsigned int nr_fpages = 0;
 
   if (start >= end)
@@ -170,7 +170,7 @@
 {
   l4_fpage_t fpages[MAX_FPAGES];
   unsigned int nr_fpages;
-  l4_word_t min_page_size = getpagesize ();
+  l4_word_t min_page_size = l4_min_page_size ();
   unsigned int i;
   l4_word_t addr;
   l4_word_t end_addr;
@@ -383,13 +383,13 @@
 serve_bootstrap_requests (void)
 {
   /* The size of the region that we are currently trying to allocate
-     for GET_MEM requests.  If this is smaller than 2^10, no more
-     memory is available.  */
+     for GET_MEM requests.  If this is smaller than L4_MIN_PAGE_SIZE,
+     no more memory is available.  */
   unsigned int get_mem_size = sizeof (l4_word_t) * 8 - 1;
 
   /* Allocate a single page at address 0, because we don't want to
      bother anybody with that silly page.  */
-  sigma0_get_fpage (l4_fpage (0, getpagesize ()));
+  sigma0_get_fpage (l4_fpage (0, l4_min_page_size ()));
 
   do
     {
@@ -431,7 +431,7 @@
              || l4_typed_words (msg_tag) != 0)
            panic ("Invalid format of get_mem msg");
 
-         if (get_mem_size < 10)
+         if (get_mem_size < L4_MIN_PAGE_SIZE_LOG2)
            panic ("physmem server does not stop requesting memory");
 
          /* Give out the memory.  First our unused fpages, then the
@@ -445,7 +445,8 @@
                if (fpage.raw == l4_nilpage.raw)
                  get_mem_size--;
              }
-           while (fpage.raw == l4_nilpage.raw && get_mem_size >= 10);
+           while (fpage.raw == l4_nilpage.raw
+                  && get_mem_size >= L4_MIN_PAGE_SIZE_LOG2);
 
          grant_item = l4_grant_item (fpage, l4_address (fpage));
          l4_msg_clear (&msg);




reply via email to

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