Changeset 085d973 in mainline for generic/src/mm/slab.c
- Timestamp:
- 2006-02-08T12:34:05Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5e3757d
- Parents:
- eb1b8b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/mm/slab.c
reb1b8b6 r085d973 97 97 #include <memstr.h> 98 98 #include <align.h> 99 #include <mm/heap.h>100 99 #include <mm/frame.h> 101 100 #include <config.h> … … 155 154 size_t fsize; 156 155 int i; 157 zone_t *zone = NULL;158 156 int status; 159 frame_t *frame; 160 161 data = (void *)frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone); 157 pfn_t pfn; 158 int zone=0; 159 160 pfn = frame_alloc_rc_zone(cache->order, FRAME_KA | flags, &status, &zone); 161 data = (void *) PA2KA(PFN2ADDR(pfn)); 162 162 if (status != FRAME_OK) { 163 163 return NULL; … … 166 166 slab = slab_alloc(slab_extern_cache, flags); 167 167 if (!slab) { 168 frame_free( (__address)data);168 frame_free(ADDR2PFN(KA2PA(data))); 169 169 return NULL; 170 170 } … … 175 175 176 176 /* Fill in slab structures */ 177 /* TODO: some better way of accessing the frame */ 178 for (i=0; i < (1 << cache->order); i++) { 179 frame = ADDR2FRAME(zone, KA2PA((__address)(data+i*PAGE_SIZE))); 180 frame->parent = slab; 181 } 177 for (i=0; i < (1 << cache->order); i++) 178 frame_set_parent(pfn+i, slab, zone); 182 179 183 180 slab->start = data; … … 200 197 static count_t slab_space_free(slab_cache_t *cache, slab_t *slab) 201 198 { 202 frame_free( (__address)slab->start);199 frame_free(ADDR2PFN(KA2PA(slab->start))); 203 200 if (! (cache->flags & SLAB_CACHE_SLINSIDE)) 204 201 slab_free(slab_extern_cache, slab); … … 212 209 static slab_t * obj2slab(void *obj) 213 210 { 214 frame_t *frame; 215 216 frame = frame_addr2frame((__address)obj); 217 return (slab_t *)frame->parent; 211 return (slab_t *)frame_get_parent(ADDR2PFN(KA2PA(obj)), 0); 218 212 } 219 213 … … 726 720 ipl = interrupts_disable(); 727 721 728 if (!(cache->flags & SLAB_CACHE_NOMAGAZINE)) 722 if (!(cache->flags & SLAB_CACHE_NOMAGAZINE)) { 729 723 result = magazine_obj_get(cache); 724 } 730 725 if (!result) 731 726 result = slab_obj_create(cache, flags);
Note:
See TracChangeset
for help on using the changeset viewer.