Mercurial > lcfOS
view cos/kernel/kernel.c @ 24:d8627924d40d
Split up in more files and reboot command
author | windel |
---|---|
date | Fri, 02 Dec 2011 14:00:02 +0100 |
parents | 5dd47d6eebac |
children | dcce92b1efbc |
line wrap: on
line source
#include "kernel.h" void startPython() { // TODO: connect to Py_Main //PyRun_SimpleString("print('hello world')"); } void testMalloc() { char *a, *b; printf("Testing malloc\n"); a = kmalloc(100); printf("Got a at %x\n", a); a[0] = 'A'; b = kmalloc(22); printf("Got b at %x\n", b); b[0] = 'B'; kfree(a); } void reboot() { while ( (inb(0x64) & 0x02) == 0x02) { ; } outb(0x64, 0xFE); } void kmain() { init_screen(); setupIDT(); // This causes error on real hardware init_heap(); printf("Welcome!\n"); while (1==1) { char buffer[70]; printf(">>>"); getline(buffer, 70); // TODO: interpret this line with python :) printf("\n"); if (buffer[0] == 'x') { printf("System time in ms: %d\n", getTimeMS()); } if (buffer[0] == 't') { testMalloc(); } if ( strncmp(buffer, "help", 4)) { printf("Help\n Try one of these commands:\n"); printf(" x: print system time in ms\n"); } if (strncmp(buffer, "r", 1)) { reboot(); } } }