/[rtmk]/rtmk/vm-map.c
ViewVC logotype

Diff of /rtmk/vm-map.c

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

revision 1.4 by jrydberg, Wed Jan 16 00:07:57 2002 UTC revision 1.5 by jrydberg, Wed Feb 6 19:57:00 2002 UTC
# Line 1  Line 1 
1  /* VM address spaces.  /* VM address spaces.
2     Copyright 1999, 2000, 2001 Johan Rydberg, jrydberg@opencores.org.     Copyright 1999, 2000, 2001, 2002 Johan Rydberg, jrydberg@opencores.org.
3    
4  This program is free software; you can redistribute it and/or modify  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by  it under the terms of the GNU General Public License as published by
# Line 148  allocate_map_entry (void) Line 148  allocate_map_entry (void)
148    return new_entry;    return new_entry;
149  }  }
150    
151    /* Conveneince function for scanning MAP for a entry that is
152       located at OFFSET.  If found, it's returned - otherwise NULL.  */
153    
154    static inline struct vm_map_entry *
155    lookup_entry_in_map (struct vm_map *map, vm_address_t offset)
156    {
157      struct vm_map_entry *entry;
158      
159      entry = vm_map_entry_first (map);
160      while (entry)
161        {
162          if ((offset >= entry->start) && (offset < entry->end))
163            return entry;
164    
165          entry = vm_map_entry_next (map, entry);
166        }
167      return 0;
168    }
169    
170  /* Initialize the VM map part of the VM system.  */  /* Initialize the VM map part of the VM system.  */
171    
172  void  void
# Line 386  vm_map_enter (struct vm_map *map, vm_add Line 405  vm_map_enter (struct vm_map *map, vm_add
405    
406    vm_map_lock (map);    vm_map_lock (map);
407    
408      /* Check so that we the entry in the map is already allocated.  */
409      if (lookup_entry_in_map (map, offset)
410          || lookup_entry_in_map (map, vm_trunc_page ((offset + size - 1))))
411        {
412          vm_map_unlock (map);
413          return KERN_NO_SPACE;
414        }
415    
416    search_entry = (struct vm_map_entry *) vm_map_entry_first (map);    search_entry = (struct vm_map_entry *) vm_map_entry_first (map);
417    
418    start_address = offset;    start_address = offset;
# Line 527  vm_map_allocate (struct vm_map *map, vm_ Line 554  vm_map_allocate (struct vm_map *map, vm_
554    return KERN_SUCCESS;    return KERN_SUCCESS;
555  }  }
556    
 /* Conveneince function for scanning MAP for a entry that is  
    located at OFFSET.  If found, it's returned - otherwise NULL.  */  
   
 static inline struct vm_map_entry *  
 lookup_entry_in_map (struct vm_map *map, vm_address_t offset)  
 {  
   struct vm_map_entry *entry;  
     
   entry = vm_map_entry_first (map);  
   while (entry)  
     {  
       if ((offset >= entry->start) && (offset < entry->end))  
         return entry;  
   
       entry = vm_map_entry_next (map, entry);  
     }  
   return 0;  
 }  
   
   
557    
558  /* Function searches for a entry located at OFFSET in MAP.  If found,  /* Function searches for a entry located at OFFSET in MAP.  If found,
559     information about it is returned in OBJECTP, ADDRESSP, PROTP and     information about it is returned in OBJECTP, ADDRESSP, PROTP and

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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