summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-01-29 20:46:14 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-01-29 20:46:14 +0100
commit1f6a99a1e7874650a62eaa106e12c00a19f7e7a1 (patch)
treeb53a939669632c193453885b3548ebd3063c9db0 /kernel
parent37db7181daf1cc10683de24f6203e595b2ac49bc (diff)
Rudimentary palloc().
Diffstat (limited to 'kernel')
-rw-r--r--kernel/SConscript1
-rw-r--r--kernel/main.c4
-rw-r--r--kernel/palloc.c15
-rw-r--r--kernel/palloc.h11
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