commit-hurd
[Top][All Lists]
Advanced

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

hurd-l4/wortel ChangeLog ia32-cmain.c wortel.c ...


From: Marcus Brinkmann
Subject: hurd-l4/wortel ChangeLog ia32-cmain.c wortel.c ...
Date: Fri, 19 Sep 2003 21:43:24 -0400

CVSROOT:        /cvsroot/hurd
Module name:    hurd-l4
Branch:         
Changes by:     Marcus Brinkmann <address@hidden>       03/09/19 21:43:24

Modified files:
        wortel         : ChangeLog ia32-cmain.c wortel.c wortel.h 

Log message:
        2003-09-20  Marcus Brinkmann  <address@hidden>
        
        * wortel.h (MAX_UNUSED_FPAGES): Move to here from wortel.c.
        (wortel_unused_fpages, wortel_unused_fpages_count): Declare here.
        * ia32-cmain.c: Include "sigma0.h".
        (add_unused_area): New function.
        (find_components): Use add_unused_area to add unused fpages to
        pool.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/ChangeLog.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/ia32-cmain.c.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.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/hurd/hurd-l4/wortel/wortel.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: hurd-l4/wortel/ChangeLog
diff -u hurd-l4/wortel/ChangeLog:1.1 hurd-l4/wortel/ChangeLog:1.2
--- hurd-l4/wortel/ChangeLog:1.1        Fri Sep 19 14:51:16 2003
+++ hurd-l4/wortel/ChangeLog    Fri Sep 19 21:43:23 2003
@@ -1,3 +1,12 @@
+2003-09-20  Marcus Brinkmann  <address@hidden>
+
+       * wortel.h (MAX_UNUSED_FPAGES): Move to here from wortel.c.
+       (wortel_unused_fpages, wortel_unused_fpages_count): Declare here.
+       * ia32-cmain.c: Include "sigma0.h".
+       (add_unused_area): New function.
+       (find_components): Use add_unused_area to add unused fpages to
+       pool.
+
 2003-09-19  Marcus Brinkmann  <address@hidden>
 
        * output-serial.c: Include <stdlib.h>.
Index: hurd-l4/wortel/ia32-cmain.c
diff -u hurd-l4/wortel/ia32-cmain.c:1.8 hurd-l4/wortel/ia32-cmain.c:1.9
--- hurd-l4/wortel/ia32-cmain.c:1.8     Thu Sep 18 18:31:18 2003
+++ hurd-l4/wortel/ia32-cmain.c Fri Sep 19 21:43:23 2003
@@ -32,6 +32,7 @@
 
 #include "wortel.h"
 #include "multiboot.h"
+#include "sigma0.h"
 
 
 /* Check if the bit BIT in FLAGS is set.  */
@@ -120,6 +121,45 @@
 extern char _end;
 
 
+/* Add the area from START to END (inclusive) to the list of unused
+   pages.  */
+static void
+add_unused_area (l4_word_t start, l4_word_t size)
+{
+  l4_word_t min_page_size = l4_min_page_size ();
+  l4_word_t end = start + size - 1;
+
+  debug ("%s: add region 0x%" L4_PRIxWORD " with size 0x%" L4_PRIxWORD "\n",
+        __func__, start, size);
+
+  /* Round down START and END.  */
+  start = start & ~(min_page_size - 1);
+  end = end & ~(min_page_size - 1);
+
+  for (; start <= end; start += min_page_size)
+    {
+      unsigned int i;
+
+      /* Only add the page if it was not added by us before.  We only
+        check the address, and not the size, because we only have to
+        check against the pages we add ourselves at this point, and
+        we only add pages of the smallest possible size.  */
+      for (i = 0; i < wortel_unused_fpages_count; i++)
+       if (l4_address (wortel_unused_fpages[i]) == start)
+         break;
+
+      if (i == wortel_unused_fpages_count)
+       {
+         l4_fpage_t fpage = l4_fpage (start, min_page_size);
+         fpage = l4_fpage_add_rights (fpage, l4_fully_accessible);
+         sigma0_get_fpage (fpage);
+         wortel_unused_fpages[i] = fpage;
+         wortel_unused_fpages_count++;
+       }
+    }
+}
+
+
 /* Find the kernel, the initial servers and the other information
    required for booting.  */
 void
@@ -133,15 +173,22 @@
       module_t *mod = (module_t *) mbi->mods_addr;
       unsigned int i;
 
+      /* Add the argument string of the first module to the list of
+        unused pages.  */
+      add_unused_area ((l4_word_t) mod[0].string,
+                      strlen ((char *) mod[0].string));
+
       mods_count = mbi->mods_count - 1;
       if (mods_count > MOD_NUMBER)
        mods_count = MOD_NUMBER;
+
       /* Skip the entry for the rootserver.  */
       mod++;
 
       for (i = 0; i < mods_count; i++)
        {
          char *args;
+         unsigned int old_mods_args_len;
 
          mods[i].name = mod_names[i];
          mods[i].start = mod[i].mod_start;
@@ -152,14 +199,28 @@
             that memory.  */
          mods[i].args = &mods_args[mods_args_len];
          args = (char *) mod[i].string;
+         old_mods_args_len = mods_args_len;
          while (*args && mods_args_len < sizeof (mods_args))
            mods_args[mods_args_len++] = *(args++);
          if (mods_args_len == sizeof (mods_args))
            panic ("No space to store the argument lines");
-           mods_args[mods_args_len++] = '\0';
+         mods_args[mods_args_len++] = '\0';
+
+         /* Now we have to add the source string's area to the list
+            of unused pages, as we touched that memory.  */
+         add_unused_area ((l4_word_t) mod[i].string,
+                          mods_args_len - old_mods_args_len);
        }
+
+      /* Add the module info itself to the list of unused pages.  */
+      add_unused_area ((l4_word_t) mbi->mods_addr,
+                      mbi->mods_count * sizeof (module_t));
     }
 
+  /* Add the multiboot info to the list of unused pages.  */
+  add_unused_area ((l4_word_t) mbi, sizeof (*mbi));
+
+  /* Finally initialize the wortel area variables.  */
   wortel_start = (l4_word_t) &_start;
   wortel_end = (l4_word_t) &_end;
 }
Index: hurd-l4/wortel/wortel.c
diff -u hurd-l4/wortel/wortel.c:1.16 hurd-l4/wortel/wortel.c:1.17
--- hurd-l4/wortel/wortel.c:1.16        Fri Sep 19 14:33:30 2003
+++ hurd-l4/wortel/wortel.c     Fri Sep 19 21:43:23 2003
@@ -40,7 +40,6 @@
    time, but don't need anymore.  It can be granted to the physical
    memory server at startup.  This includes architecture dependent
    boot data as well as the physical memory server module.  */
-#define MAX_UNUSED_FPAGES 32
 l4_fpage_t wortel_unused_fpages[MAX_UNUSED_FPAGES];
 unsigned int wortel_unused_fpages_count;
 
Index: hurd-l4/wortel/wortel.h
diff -u hurd-l4/wortel/wortel.h:1.7 hurd-l4/wortel/wortel.h:1.8
--- hurd-l4/wortel/wortel.h:1.7 Mon Sep 15 20:42:17 2003
+++ hurd-l4/wortel/wortel.h     Fri Sep 19 21:43:24 2003
@@ -43,6 +43,15 @@
 extern l4_word_t wortel_end;
 
 
+/* Unused memory.  These fpages mark memory which we needed at some
+   time, but don't need anymore.  It can be granted to the physical
+   memory server at startup.  This includes architecture dependent
+   boot data as well as the physical memory server module.  */
+#define MAX_UNUSED_FPAGES 32
+extern l4_fpage_t wortel_unused_fpages[MAX_UNUSED_FPAGES];
+extern unsigned int wortel_unused_fpages_count;
+
+
 /* Room for the arguments.  1 KB is a cramped half-screen full, which
    should be more than enough.  Arguments need to be copied here by
    the architecture dependent find_components, so all precious data is




reply via email to

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