summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kernel.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index ebb3841..ce22b84 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,15 +1,8 @@
-//
-// http://www.jamesmolloy.co.uk/tutorial_html/9.-Multitasking.html
-//
+#define FOOLOS_MODULE_NAME "kernel"
-#include "kernel.h" // general kernel config & includes
-#include "console.h" // this will allow us to write to screen
#include "x86.h"
-
#include "../lib/logger/log.h" // logger facilities
-#define FOOLOS_MODULE_NAME "kernel"
-
-// TODO: cleanup . WHHYY can i compile it without the includes!??
+// TODO: WHHYY can i compile it without the includes!???
///////
// interrupt handler prototypes
@@ -19,12 +12,9 @@ void int_clock_handler();
void int_kb_handler();
void int_floppy_handler();
-////////// KERNEL MAIN///// /////
-//
uint32_t read_eip();
-
void int_irq0(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Divide by 0"); X86_IRQ_END }
void int_irq1(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Single step (debugger)"); X86_IRQ_END }
void int_irq2(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Non Maskable Interrupt"); X86_IRQ_END }
@@ -67,18 +57,34 @@ void int_irq16(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Coprocessor error");
void int_irq17(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Alignment Check"); X86_IRQ_END }
void int_irq18(){ X86_IRQ_BEGIN panic(FOOLOS_MODULE_NAME,"Machine Check"); X86_IRQ_END }
+// enable A20
+// http://www.brokenthorn.com/Resources/OSDev9.html
+// Method 3.1: Enables A20 through keyboard controller
+/*
void enable_a20()
{
-//; ;enable A20
-//; ;http://www.brokenthorn.com/Resources/OSDev9.html
-//; ;Method 3.1: Enables A20 through keyboard controller
-//; ;Not all keyboard controllers support this
+// Not all keyboard controllers support this
asm("mov $0xdd, %al");// ; command 0xdd: enable a20
-//; ;mov al, 0xdf ; command 0xdf: disable a20
+// asm("mov $0xdf, %al");// ; command 0xdd: disable a20
asm("outb %al, $0x64");// ; send command to controller
}
+*/
-// heart of our operating system.
+/*
+void test_a20()
+{
+ uint16_t *test=0x7dfe;
+ test+=1024*1024;
+// *test=0x69;
+// test=0x8abcd;
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"A20 test: 0x%02X ",*test);
+
+
+}
+*/
+
+////////// KERNEL MAIN///// /////
+// this is the very heart of our operating system!
void kernel_main(uint32_t initial_stack)
{
@@ -101,13 +107,12 @@ void kernel_main(uint32_t initial_stack)
// this function returns the physical base address of
// our video memory
//
+
uint32_t vesa_physbase=vesa_init(0x8300,0x8400,0x7200);
// initial stack
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"enable A20");
- enable_a20();
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"setup PIC");
pic_setup();