diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/SConscript | 1 | ||||
-rw-r--r-- | kernel/main.c | 4 | ||||
-rw-r--r-- | kernel/palloc.c | 15 | ||||
-rw-r--r-- | kernel/palloc.h | 11 |
4 files changed, 31 insertions, 0 deletions
diff --git a/kernel/SConscript b/kernel/SConscript index 89b5f03..47af722 100644 --- a/kernel/SConscript +++ b/kernel/SConscript @@ -34,6 +34,7 @@ kernel = env.Kernel('kernel', [ 'idt.c', 'irq.c', 'main.c', + 'palloc.c', 'panic.c', 'printf.c', ]) diff --git a/kernel/main.c b/kernel/main.c index 5cc94d3..e8de5d2 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -1,4 +1,5 @@ #include "printf.h" +#include "palloc.h" #include "gdt.h" #include "idt.h" #include "irq.h" @@ -7,6 +8,9 @@ void main() { printf("main()\n"); + palloc_init(); + printf("Page allocator initiated.\n"); + gdt_init(); printf("GDT set.\n"); diff --git a/kernel/palloc.c b/kernel/palloc.c new file mode 100644 index 0000000..5ad6e56 --- /dev/null +++ b/kernel/palloc.c @@ -0,0 +1,15 @@ +#include "palloc.h" + +uint32_t palloc_last = 0x200000; + +void palloc_init() { + // TODO: Initialize bitmap from memory map. +} + +uint32_t palloc() { + return palloc_last += 0x1000; +} + +void pfree(uint32_t addr) { + +} diff --git a/kernel/palloc.h b/kernel/palloc.h new file mode 100644 index 0000000..f846a96 --- /dev/null +++ b/kernel/palloc.h @@ -0,0 +1,11 @@ +#ifndef PALLOC_H +#define PALLOC_H + +#include "types.h" + +void palloc_init(); + +uint32_t palloc(); +void pfree(uint32_t addr); + +#endif |