Example #1
0
static int _kmem_free_obj(struct kmem_cache_t *cachep, void *objp)
{
    if(cachep == NULL || objp == NULL)
        return -1;

    /*unsigned long address = ((unsigned long )objp & (~(DEFAULT_SLAB_PAGES * PAGE_SIZE) + 1));*/
    unsigned long address = ((unsigned long )objp & VALUE_MASK(DEFAULT_SLAB_PAGES * PAGE_SIZE));
    struct slab *slabp = (struct slab *)address;
    /*printf("slabp = %x.\n",slabp);*/

    return slab_free_obj(cachep,slabp,objp);
}
Example #2
0
static int _kmem_free_obj(kmem_cache_t *cachep, void *objp)
{
    if(cachep == NULL || objp == NULL)
    {
        return -1;
    }

    unsigned long address = ((unsigned long )objp & VALUE_MASK(DEFAULT_SLAB_PAGES * PAGE_SIZE));
    struct slab *slabp = (struct slab *)address;

    return slab_free_obj(cachep,slabp,objp);
}