Subversion Repositories HelenOS-historic

Rev

Rev 762 | Rev 764 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 762 Rev 763
Line 84... Line 84...
84
        fsize = (PAGE_SIZE << cache->order);
84
        fsize = (PAGE_SIZE << cache->order);
85
        slab = data + fsize - sizeof(*slab);
85
        slab = data + fsize - sizeof(*slab);
86
    }
86
    }
87
 
87
 
88
    /* Fill in slab structures */
88
    /* Fill in slab structures */
89
    /* TODO: some better way of accessing the frame, although
89
    /* TODO: some better way of accessing the frame */
90
     * the optimizer might optimize the division out :-/ */
-
 
91
    for (i=0; i< (1<<cache->order); i++) {
90
    for (i=0; i< (1<<cache->order); i++) {
92
        ADDR2FRAME(zone, (__address)(data+i*PAGE_SIZE))->parent = slab;
91
        ADDR2FRAME(zone, (__address)(data+i*PAGE_SIZE))->parent = slab;
93
    }
92
    }
94
 
93
 
95
    slab->start = data;
94
    slab->start = data;
Line 142... Line 141...
142
    count_t frames = 0;
141
    count_t frames = 0;
143
 
142
 
144
    if (!slab)
143
    if (!slab)
145
        slab = obj2slab(obj);
144
        slab = obj2slab(obj);
146
 
145
 
147
    spinlock_lock(cache->lock);
146
    spinlock_lock(&cache->lock);
148
 
147
 
149
    *((int *)obj) = slab->nextavail;
148
    *((int *)obj) = slab->nextavail;
150
    slab->nextavail = (obj - slab->start)/cache->size;
149
    slab->nextavail = (obj - slab->start)/cache->size;
151
    slab->available++;
150
    slab->available++;
152
 
151
 
Line 163... Line 162...
163
        spinlock_unlock(&cache->lock);
162
        spinlock_unlock(&cache->lock);
164
        frames = slab_space_free(cache, slab);
163
        frames = slab_space_free(cache, slab);
165
        spinlock_lock(&cache->lock);
164
        spinlock_lock(&cache->lock);
166
    }
165
    }
167
 
166
 
168
    spinlock_unlock(cache->lock);
167
    spinlock_unlock(&cache->lock);
169
 
168
 
170
    return frames;
169
    return frames;
171
}
170
}
172
 
171
 
173
/**
172
/**