selfmade-os

diff kernel.c @ 1:42ba76f77035

the kernel with output and mem alloc
author meillo@marmaro.de
date Sun, 01 Nov 2009 23:50:51 +0100
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/kernel.c	Sun Nov 01 23:50:51 2009 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +/* markus schnalke <meillo@marmaro.de> */
     1.5 +
     1.6 +#include "io.h"
     1.7 +#include "mem.h"
     1.8 +
     1.9 +void
    1.10 +kmain(void)
    1.11 +{
    1.12 +	unsigned char* p;
    1.13 +
    1.14 +	cls();
    1.15 +	printf("OS says: Hi!\n\n");
    1.16 +
    1.17 +	initmem(0x00400000);  /* heap starts at 4MB */
    1.18 +
    1.19 +	printf("init done\n");
    1.20 +	printf("\n");
    1.21 +
    1.22 +	p = malloc(28);
    1.23 +	printf("allocated %d bytes at %p\n", 28, p);
    1.24 +	p = malloc(15);
    1.25 +	printf("allocated %d bytes at %p\n", 15, p);
    1.26 +
    1.27 +	printf("aa %d bb %c cc %s\n", 5, '@', "hallo");
    1.28 +	printf("minmem: %p\n", 0x00400000);
    1.29 +
    1.30 +	setpos(24, 0);
    1.31 +	printf("loop\n");
    1.32 +	while (1) {
    1.33 +	}
    1.34 +}