/[hurd]/hurd-l4/wortel/ia32-cmain.c
ViewVC logotype

Diff of /hurd-l4/wortel/ia32-cmain.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by marcus, Thu Sep 18 22:31:18 2003 UTC revision 1.9 by marcus, Sat Sep 20 01:43:23 2003 UTC
# Line 32  Line 32 
32    
33  #include "wortel.h"  #include "wortel.h"
34  #include "multiboot.h"  #include "multiboot.h"
35    #include "sigma0.h"
36    
37    
38  /* Check if the bit BIT in FLAGS is set.  */  /* Check if the bit BIT in FLAGS is set.  */
# Line 120  extern char _start; Line 121  extern char _start;
121  extern char _end;  extern char _end;
122    
123    
124    /* Add the area from START to END (inclusive) to the list of unused
125       pages.  */
126    static void
127    add_unused_area (l4_word_t start, l4_word_t size)
128    {
129      l4_word_t min_page_size = l4_min_page_size ();
130      l4_word_t end = start + size - 1;
131    
132      debug ("%s: add region 0x%" L4_PRIxWORD " with size 0x%" L4_PRIxWORD "\n",
133             __func__, start, size);
134    
135      /* Round down START and END.  */
136      start = start & ~(min_page_size - 1);
137      end = end & ~(min_page_size - 1);
138    
139      for (; start <= end; start += min_page_size)
140        {
141          unsigned int i;
142    
143          /* Only add the page if it was not added by us before.  We only
144             check the address, and not the size, because we only have to
145             check against the pages we add ourselves at this point, and
146             we only add pages of the smallest possible size.  */
147          for (i = 0; i < wortel_unused_fpages_count; i++)
148            if (l4_address (wortel_unused_fpages[i]) == start)
149              break;
150    
151          if (i == wortel_unused_fpages_count)
152            {
153              l4_fpage_t fpage = l4_fpage (start, min_page_size);
154              fpage = l4_fpage_add_rights (fpage, l4_fully_accessible);
155              sigma0_get_fpage (fpage);
156              wortel_unused_fpages[i] = fpage;
157              wortel_unused_fpages_count++;
158            }
159        }
160    }
161    
162    
163  /* Find the kernel, the initial servers and the other information  /* Find the kernel, the initial servers and the other information
164     required for booting.  */     required for booting.  */
165  void  void
# Line 133  find_components (void) Line 173  find_components (void)
173        module_t *mod = (module_t *) mbi->mods_addr;        module_t *mod = (module_t *) mbi->mods_addr;
174        unsigned int i;        unsigned int i;
175    
176          /* Add the argument string of the first module to the list of
177             unused pages.  */
178          add_unused_area ((l4_word_t) mod[0].string,
179                           strlen ((char *) mod[0].string));
180    
181        mods_count = mbi->mods_count - 1;        mods_count = mbi->mods_count - 1;
182        if (mods_count > MOD_NUMBER)        if (mods_count > MOD_NUMBER)
183          mods_count = MOD_NUMBER;          mods_count = MOD_NUMBER;
184    
185        /* Skip the entry for the rootserver.  */        /* Skip the entry for the rootserver.  */
186        mod++;        mod++;
187    
188        for (i = 0; i < mods_count; i++)        for (i = 0; i < mods_count; i++)
189          {          {
190            char *args;            char *args;
191              unsigned int old_mods_args_len;
192    
193            mods[i].name = mod_names[i];            mods[i].name = mod_names[i];
194            mods[i].start = mod[i].mod_start;            mods[i].start = mod[i].mod_start;
# Line 152  find_components (void) Line 199  find_components (void)
199               that memory.  */               that memory.  */
200            mods[i].args = &mods_args[mods_args_len];            mods[i].args = &mods_args[mods_args_len];
201            args = (char *) mod[i].string;            args = (char *) mod[i].string;
202              old_mods_args_len = mods_args_len;
203            while (*args && mods_args_len < sizeof (mods_args))            while (*args && mods_args_len < sizeof (mods_args))
204              mods_args[mods_args_len++] = *(args++);              mods_args[mods_args_len++] = *(args++);
205            if (mods_args_len == sizeof (mods_args))            if (mods_args_len == sizeof (mods_args))
206              panic ("No space to store the argument lines");              panic ("No space to store the argument lines");
207              mods_args[mods_args_len++] = '\0';            mods_args[mods_args_len++] = '\0';
208    
209              /* Now we have to add the source string's area to the list
210                 of unused pages, as we touched that memory.  */
211              add_unused_area ((l4_word_t) mod[i].string,
212                               mods_args_len - old_mods_args_len);
213          }          }
214    
215          /* Add the module info itself to the list of unused pages.  */
216          add_unused_area ((l4_word_t) mbi->mods_addr,
217                           mbi->mods_count * sizeof (module_t));
218      }      }
219    
220      /* Add the multiboot info to the list of unused pages.  */
221      add_unused_area ((l4_word_t) mbi, sizeof (*mbi));
222    
223      /* Finally initialize the wortel area variables.  */
224    wortel_start = (l4_word_t) &_start;    wortel_start = (l4_word_t) &_start;
225    wortel_end = (l4_word_t) &_end;    wortel_end = (l4_word_t) &_end;
226  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26