/[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.6 by marcus, Mon Sep 15 19:24:01 2003 UTC revision 1.7 by marcus, Tue Sep 16 00:42:17 2003 UTC
# Line 50  cmain (void) Line 50  cmain (void)
50    l4_init_stubs ();    l4_init_stubs ();
51    
52    mbi = (multiboot_info_t *) l4_boot_info ();    mbi = (multiboot_info_t *) l4_boot_info ();
53    debug ("Multiboot Info: 0x%x\n", mbi);    debug ("Multiboot Info: %p\n", mbi);
54    
55    if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count > 0)    if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count > 0)
56      {      {
# Line 101  cmain (void) Line 101  cmain (void)
101        argc = 1;        argc = 1;
102    
103        argv = alloca (sizeof (char *) * 2);        argv = alloca (sizeof (char *) * 2);
104        argv[0] = program_name;        argv[0] = (char *) program_name;
105        argv[1] = 0;        argv[1] = 0;
106      }      }
107    
# Line 124  extern char _end; Line 124  extern char _end;
124  void  void
125  find_components (void)  find_components (void)
126  {  {
   l4_word_t min_page_size = getpagesize ();  
127    multiboot_info_t *mbi = (multiboot_info_t *) l4_boot_info ();    multiboot_info_t *mbi = (multiboot_info_t *) l4_boot_info ();
   l4_word_t start;  
   l4_word_t end;  
128    
129    /* Load the module information.  */    /* Load the module information.  */
130    if (CHECK_FLAG (mbi->flags, 3))    if (CHECK_FLAG (mbi->flags, 3))
# Line 143  find_components (void) Line 140  find_components (void)
140    
141        for (i = 0; i < mods_count; i++)        for (i = 0; i < mods_count; i++)
142          {          {
143              char *args;
144    
145            mods[i].name = mod_names[i];            mods[i].name = mod_names[i];
146            mods[i].start = mod[i].mod_start;            mods[i].start = mod[i].mod_start;
147            if (mods[i].start & (min_page_size - 1))            mods[i].end = mod[i].mod_end;
             panic ("Module %s does not start on a page boundary.\n");  
           mods[i].end = (mod[i].mod_end + min_page_size - 1)  
             & ~(min_page_size - 1);  
           mods[i].args = (char *) mod[i].string;  
         }  
     }  
   
   /* Now protect ourselves and the multiboot info (at least the module  
      configuration).  */  
   loader_add_region (program_name, (l4_word_t) &_start, (l4_word_t) &_end);  
   
   start = (l4_word_t) mbi;  
   end = start + sizeof (*mbi);  
   loader_add_region ("grub-mbi", start, end);  
     
   if (CHECK_FLAG (mbi->flags, 3) && mbi->mods_count)  
     {  
       module_t *mod = (module_t *) mbi->mods_addr;  
       int nr;  
148    
149        start = (l4_word_t) mod;            /* We copy over the argument lines, so that we don't depend
150        end = ((l4_word_t) mod) + mbi->mods_count * sizeof (*mod);               on the multiboot info structure anymore, and can reuse
151        loader_add_region ("grub-mods", start, end);               that memory.  */
152              mods[i].args = &mods_args[mods_args_len];
153        start = (l4_word_t) mod[0].string;            args = (char *) mod[i].string;
154        end = start + 1;            while (*args && mods_args_len < sizeof (mods_args))
155        for (nr = 0; nr < mbi->mods_count; nr++)              mods_args[mods_args_len++] = *(args++);
156          {            if (mods_args_len == sizeof (mods_args))
157            char *str = (char *) mod[nr].string;              panic ("No space to store the argument lines");
158                mods_args[mods_args_len++] = '\0';
           if (str)  
             {  
               if (((l4_word_t) str) < start)  
                 start = (l4_word_t) str;  
               while (*str)  
                 str++;  
               if (((l4_word_t) str) + 1> end)  
                 end = (l4_word_t) str + 1;  
             }  
159          }          }
       loader_add_region ("grub-mods-cmdlines", start, end + 1);  
160      }      }
161    
162      wortel_start = (l4_word_t) &_start;
163      wortel_end = (l4_word_t) &_end;
164  }  }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

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