# HG changeset patch # User John Tsiombikas # Date 1301135277 -7200 # Node ID 2cbc2b922e49843471e2f47ea435d14a53dcf959 # Parent 7f9af8cddc961e1cc1fe75b3788706da5009f15c adding paging diff -r 7f9af8cddc96 -r 2cbc2b922e49 Makefile --- a/Makefile Sat Mar 05 16:59:49 2011 +0200 +++ b/Makefile Sat Mar 26 12:27:57 2011 +0200 @@ -8,10 +8,12 @@ CC = gcc +inc = -Isrc -Isrc/klibc -Isrc/boot + # -nostdinc instructs the compiler to ignore standard include directories # -m32 instructs the compiler to produce 32bit code (in case we have a 64bit compiler) -CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin -Isrc -Isrc/klibc -ASFLAGS = -m32 -g -nostdinc -fno-builtin -Isrc -Isrc/klibc +CFLAGS = -m32 -Wall -g -nostdinc -fno-builtin $(inc) +ASFLAGS = -m32 -g -nostdinc -fno-builtin $(inc) bin = kernel.elf diff -r 7f9af8cddc96 -r 2cbc2b922e49 src/boot/mboot.S --- a/src/boot/mboot.S Sat Mar 05 16:59:49 2011 +0200 +++ b/src/boot/mboot.S Sat Mar 26 12:27:57 2011 +0200 @@ -1,5 +1,6 @@ #define MAGIC 0x1badb002 -#define FLAGS 0 +/* flags with bit 1 set means we need memory info */ +#define FLAGS 2 #define STACK_SIZE 0x4000 .text @@ -17,7 +18,9 @@ /* reset eflags register */ pushl $0 popf - /* call the kernel main function */ + /* call the kernel main function. ebx points to the + * multiboot information structure */ + push %ebx call kmain /* we dropped out of main, halt the CPU */ cli diff -r 7f9af8cddc96 -r 2cbc2b922e49 src/main.c --- a/src/main.c Sat Mar 05 16:59:49 2011 +0200 +++ b/src/main.c Sat Mar 26 12:27:57 2011 +0200 @@ -1,10 +1,13 @@ #include +#include "mboot.h" #include "vid.h" #include "term.h" -#include +#include "asmops.h" #include "segm.h" #include "intr.h" -#include "panic.h" +#include "vm.h" + +static void do_nothing(); /* special keys */ enum { @@ -34,22 +37,26 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* 70 - 7f */ }; -void kmain(void) +void kmain(struct mboot_info *mbinf) { clear_scr(); + + /* pointless verbal diarrhea */ + if(mbinf->flags & MB_LDRNAME) { + printf("loaded by: %s\n", mbinf->boot_loader_name); + } + if(mbinf->flags & MB_CMDLINE) { + printf("kernel command line: %s\n", mbinf->cmdline); + } + puts("kernel starting up"); init_segm(); init_intr(); + init_vm(mbinf); - set_text_color(YELLOW); - puts(""); - set_text_color(LTGRAY); - puts("hello world!"); - - asm volatile("int $0x80"); - - panic("foo\n"); + /* silence the blasted timer interrupt */ + interrupt(32, do_nothing); for(;;) { char c, keypress; @@ -62,3 +69,7 @@ } } } + +static void do_nothing() +{ +}