kern

diff src/main.c @ 16:2cbc2b922e49

adding paging
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 26 Mar 2011 12:27:57 +0200
parents 6c9138a87e02
children 8be069e6bb05
line diff
     1.1 --- a/src/main.c	Sat Mar 05 16:59:49 2011 +0200
     1.2 +++ b/src/main.c	Sat Mar 26 12:27:57 2011 +0200
     1.3 @@ -1,10 +1,13 @@
     1.4  #include <stdio.h>
     1.5 +#include "mboot.h"
     1.6  #include "vid.h"
     1.7  #include "term.h"
     1.8 -#include <asmops.h>
     1.9 +#include "asmops.h"
    1.10  #include "segm.h"
    1.11  #include "intr.h"
    1.12 -#include "panic.h"
    1.13 +#include "vm.h"
    1.14 +
    1.15 +static void do_nothing();
    1.16  
    1.17  /* special keys */
    1.18  enum {
    1.19 @@ -34,22 +37,26 @@
    1.20  	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0									/* 70 - 7f */
    1.21  };
    1.22  
    1.23 -void kmain(void)
    1.24 +void kmain(struct mboot_info *mbinf)
    1.25  {
    1.26  	clear_scr();
    1.27 +
    1.28 +	/* pointless verbal diarrhea */
    1.29 +	if(mbinf->flags & MB_LDRNAME) {
    1.30 +		printf("loaded by: %s\n", mbinf->boot_loader_name);
    1.31 +	}
    1.32 +	if(mbinf->flags & MB_CMDLINE) {
    1.33 +		printf("kernel command line: %s\n", mbinf->cmdline);
    1.34 +	}
    1.35 +
    1.36  	puts("kernel starting up");
    1.37  
    1.38  	init_segm();
    1.39  	init_intr();
    1.40 +	init_vm(mbinf);
    1.41  
    1.42 -	set_text_color(YELLOW);
    1.43 -	puts("<initialization code goes here>");
    1.44 -	set_text_color(LTGRAY);
    1.45 -	puts("hello world!");
    1.46 -
    1.47 -	asm volatile("int $0x80");
    1.48 -
    1.49 -	panic("foo\n");
    1.50 +	/* silence the blasted timer interrupt */
    1.51 +	interrupt(32, do_nothing);
    1.52  
    1.53  	for(;;) {
    1.54  		char c, keypress;
    1.55 @@ -62,3 +69,7 @@
    1.56  		}
    1.57  	}
    1.58  }
    1.59 +
    1.60 +static void do_nothing()
    1.61 +{
    1.62 +}