Changeset 085d973 in mainline for generic/src/mm/slab.c


Ignore:
Timestamp:
2006-02-08T12:34:05Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5e3757d
Parents:
eb1b8b6
Message:

Cleanup o frame allocator.
Removed early_malloc & initial heap.
Will break ia64, ppc & sparc.
Added e820 table print.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/mm/slab.c

    reb1b8b6 r085d973  
    9797#include <memstr.h>
    9898#include <align.h>
    99 #include <mm/heap.h>
    10099#include <mm/frame.h>
    101100#include <config.h>
     
    155154        size_t fsize;
    156155        int i;
    157         zone_t *zone = NULL;
    158156        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));
    162162        if (status != FRAME_OK) {
    163163                return NULL;
     
    166166                slab = slab_alloc(slab_extern_cache, flags);
    167167                if (!slab) {
    168                         frame_free((__address)data);
     168                        frame_free(ADDR2PFN(KA2PA(data)));
    169169                        return NULL;
    170170                }
     
    175175               
    176176        /* 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);
    182179
    183180        slab->start = data;
     
    200197static count_t slab_space_free(slab_cache_t *cache, slab_t *slab)
    201198{
    202         frame_free((__address)slab->start);
     199        frame_free(ADDR2PFN(KA2PA(slab->start)));
    203200        if (! (cache->flags & SLAB_CACHE_SLINSIDE))
    204201                slab_free(slab_extern_cache, slab);
     
    212209static slab_t * obj2slab(void *obj)
    213210{
    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);
    218212}
    219213
     
    726720        ipl = interrupts_disable();
    727721
    728         if (!(cache->flags & SLAB_CACHE_NOMAGAZINE))
     722        if (!(cache->flags & SLAB_CACHE_NOMAGAZINE)) {
    729723                result = magazine_obj_get(cache);
     724        }
    730725        if (!result)
    731726                result = slab_obj_create(cache, flags);
Note: See TracChangeset for help on using the changeset viewer.