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

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

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

revision 1.13 by marcus, Wed Sep 17 07:45:26 2003 UTC revision 1.14 by marcus, Wed Sep 17 14:23:00 2003 UTC
# Line 121  loader_get_memory_desc (l4_word_t nr) Line 121  loader_get_memory_desc (l4_word_t nr)
121  #define MAX_FPAGES (sizeof (l4_word_t) * 8 - 10)  #define MAX_FPAGES (sizeof (l4_word_t) * 8 - 10)
122    
123    
 /* Find the first bit set.  The least significant bit is 1.  If no bit  
    is set, return 0.  FIXME: This can be optimized a lot, in an  
    archtecture dependent way.  Add to libl4, like __l4_msb().  */  
 static inline unsigned int  
 wffs (l4_word_t nr)  
 {  
   unsigned int bit = 0;  
   
   while (bit < sizeof (l4_word_t) * 8)  
     {  
       if ((1ULL << bit) & nr)  
         {  
           return bit + 1;  
         }  
       bit++;  
     }  
 }  
   
   
124  /* Determine the fpages required to cover the bytes from START to END  /* Determine the fpages required to cover the bytes from START to END
125     (exclusive).  START must be aligned to the minimal page size     (exclusive).  START must be aligned to the minimal page size
126     supported by the system.  Returns the number of fpages required to     supported by the system.  Returns the number of fpages required to
# Line 164  make_fpages (l4_word_t start, l4_word_t Line 145  make_fpages (l4_word_t start, l4_word_t
145    nr_fpages = 0;    nr_fpages = 0;
146    while (start < end)    while (start < end)
147      {      {
148          unsigned int addr_align;
149          unsigned int size_align;
150    
151        /* Each fpage must be self-aligned.  */        /* Each fpage must be self-aligned.  */
152        unsigned int fpsize_log2 = wffs (start | (end - start)) - 1;        addr_align = l4_lsb (start) - 1;
153          size_align = l4_msb (end - start) - 1;
154          if (addr_align < size_align)
155            size_align = addr_align;
156    
157        fpages[nr_fpages]        fpages[nr_fpages]
158          = l4_fpage_add_rights (l4_fpage_log2 (start, fpsize_log2),          = l4_fpage_add_rights (l4_fpage_log2 (start, size_align),
159                                 l4_fully_accessible);                                 l4_fully_accessible);
160        start += l4_size (fpages[nr_fpages]);        start += l4_size (fpages[nr_fpages]);
161        nr_fpages++;        nr_fpages++;

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

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