Subversion Repositories HelenOS-historic

Rev

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

Rev 552 Rev 590
Line 32... Line 32...
32
#include <memstr.h>
32
#include <memstr.h>
33
#include <panic.h>
33
#include <panic.h>
34
#include <arch/types.h>
34
#include <arch/types.h>
35
#include <arch/asm.h>
35
#include <arch/asm.h>
36
#include <arch.h>
36
#include <arch.h>
-
 
37
#include <align.h>
37
 
38
 
38
/*
39
/*
39
 * First-fit algorithm.
40
 * First-fit algorithm.
40
 * Simple, but hopefully correct.
41
 * Simple, but hopefully correct.
41
 * Chunks being freed are tested for mergability with their neighbours.
42
 * Chunks being freed are tested for mergability with their neighbours.
Line 61... Line 62...
61
void *early_malloc(size_t size)
62
void *early_malloc(size_t size)
62
{
63
{
63
    ipl_t ipl;
64
    ipl_t ipl;
64
    chunk_t *x, *y, *z;
65
    chunk_t *x, *y, *z;
65
 
66
 
-
 
67
    size = ALIGN_UP(size, sizeof(__native));
-
 
68
 
66
    if (size == 0)
69
    if (size == 0)
67
        panic("zero-size allocation request");
70
        panic("zero-size allocation request");
68
       
71
       
69
    x = chunk0;
72
    x = chunk0;
70
    ipl = interrupts_disable();
73
    ipl = interrupts_disable();