2 * GeekOS memory allocation API
3 * Copyright (c) 2001, David H. Hovemeyer <daveho@cs.umd.edu>
6 * This is free software. You are permitted to use,
7 * redistribute, and modify it as specified in the file "COPYING".
10 #include <geekos/screen.h>
11 #include <geekos/int.h>
12 #include <geekos/bget.h>
13 #include <geekos/kassert.h>
14 #include <geekos/malloc.h>
17 * Initialize the heap starting at given address and occupying
18 * specified number of bytes.
20 void Init_Heap(ulong_t start, ulong_t size)
22 /*Print("Creating kernel heap: start=%lx, size=%ld\n", start, size);*/
23 bpool((void*) start, size);
27 * Dynamically allocate a buffer of given size.
28 * Returns null if there is not enough memory to satisfy the
31 void* Malloc(ulong_t size)
38 iflag = Begin_Int_Atomic();
40 End_Int_Atomic(iflag);
46 * Free a buffer allocated with Malloc() or Malloc().
52 iflag = Begin_Int_Atomic();
54 End_Int_Atomic(iflag);