summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-01-20 22:20:18 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-01-20 22:20:37 +0100
commit63e9609b234b9eb8da73709491cac2233bbede35 (patch)
tree82a452e3e6641f4c6761f14e4c867f4bb9896323 /kernel
parent043b8b9d4624d4208a330cbce9775c43f1bf1fc6 (diff)
Executing foo-module.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/entry.c7
-rw-r--r--kernel/main.c9
-rw-r--r--kernel/multiboot.h9
3 files changed, 22 insertions, 3 deletions
diff --git a/kernel/entry.c b/kernel/entry.c
index 2496d21..61ac82b 100644
--- a/kernel/entry.c
+++ b/kernel/entry.c
@@ -47,6 +47,8 @@ void entry_main(uint32_t mb_magic, multiboot_info* mb_info) {
entry_serial_out("No cmdline.\n");
}
+ entry_serial_out("Module addr: ");
+ entry_serial_out_hex(mb_info->mods_addr->mod_start);
// Create initial page tables.
for(unsigned int i = 0; i < 1024; i++) {
@@ -54,7 +56,8 @@ void entry_main(uint32_t mb_magic, multiboot_info* mb_info) {
entry_pagedir[i] = 0;
// Identity mapping of the current code.
- entry_pagetable_low[i] = ((uint32_t)&addr_phys & 0xffc00000) | (i << 12) | 0x003;
+ //entry_pagetable_low[i] = ((uint32_t)&addr_phys & 0xffc00000) | (i << 12) | 0x003;
+ entry_pagetable_low[i] = ((uint32_t)&addr_phys & 0xffc00000) | (i << 12) | 0x007;
// Map kernelspace.
if((i << 12) < ((uint32_t)&addr_virt_end & 0x003fffff)) {
@@ -64,7 +67,7 @@ void entry_main(uint32_t mb_magic, multiboot_info* mb_info) {
}
}
- entry_pagedir[(uint32_t)&addr_phys >> 22] = (uint32_t)&entry_pagetable_low | 0x003;
+ entry_pagedir[(uint32_t)&addr_phys >> 22] = (uint32_t)&entry_pagetable_low | 0x007;
entry_pagedir[(uint32_t)&addr_virt >> 22] = (uint32_t)&entry_pagetable_high | 0x003;
// Mapping stack to top without creating another page directory.
diff --git a/kernel/main.c b/kernel/main.c
index 74ba441..93647f5 100644
--- a/kernel/main.c
+++ b/kernel/main.c
@@ -17,6 +17,15 @@ void main() {
asm volatile("sti");
+ asm volatile(
+ "push $0x23\n"
+ "push $entry_stack_top\n"
+ "pushf\n"
+ "push $0x1b\n"
+ "push $0x0010a000\n"
+ "iret\n"
+ );
+
printf("Halting.\n");
asm volatile(
diff --git a/kernel/multiboot.h b/kernel/multiboot.h
index 5a9e348..93a5c30 100644
--- a/kernel/multiboot.h
+++ b/kernel/multiboot.h
@@ -4,6 +4,13 @@
#include "types.h"
typedef struct {
+ uint32_t mod_start;
+ uint32_t mod_end;
+ char* string;
+ uint32_t reserved;
+} multiboot_module;
+
+typedef struct {
uint32_t flags;
uint32_t mem_lower;
@@ -14,7 +21,7 @@ typedef struct {
char* cmdline;
uint32_t mods_count;
- uint32_t mods_addr;
+ multiboot_module* mods_addr;
union {
uint32_t foo[3];