Subversion Repositories HelenOS-historic

Rev

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

Rev 615 Rev 623
Line 41... Line 41...
41
 * Simple, but hopefully correct.
41
 * Simple, but hopefully correct.
42
 * Chunks being freed are tested for mergability with their neighbours.
42
 * Chunks being freed are tested for mergability with their neighbours.
43
 */
43
 */
44
 
44
 
45
static chunk_t *chunk0;
45
static chunk_t *chunk0;
46
static spinlock_t heaplock;
46
SPINLOCK_INITIALIZE(heaplock);
47
 
47
 
48
void early_heap_init(__address heap, size_t size)
48
void early_heap_init(__address heap, size_t size)
49
{
49
{
50
    spinlock_initialize(&heaplock, "heap_lock");
-
 
51
    memsetb(heap, size, 0);
50
    memsetb(heap, size, 0);
52
    chunk0 = (chunk_t *) heap;
51
    chunk0 = (chunk_t *) heap;
53
    chunk0->used = 0;
52
    chunk0->used = 0;
54
    chunk0->size = size - sizeof(chunk_t);
53
    chunk0->size = size - sizeof(chunk_t);
55
    chunk0->next = NULL;
54
    chunk0->next = NULL;