summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-02 14:53:09 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-02 14:53:09 +0200
commit5348a94a6e7a16a070c502c29db30a08253a99a3 (patch)
treea60838ee9c4b7ac854084fe0eeb0e579a5afc33d /kernel/kernel.c
parent347ee926fd09d7fb45025f2c4e4a4eeab83459c9 (diff)
Debugging paging problem on VirtualBox (VT-x)
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c64
1 files changed, 36 insertions, 28 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 7bbfcce..429a286 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -25,22 +25,17 @@ void kernel_main(uint32_t initial_stack, int mp)
{
+ volatile static uint32_t cpu1_counter=0;
+
// catch the APs (Application Processors)
+ /*
if(mp==1)
{
- uint16_t c3=0;
- while(1)
- {
-
-
- c3++;
- asm("cli");
-
- PutString("cpu2: %03d", 200,560,0b1111100000000000, c3/100);
-
- asm("sti");
- }
+ //while(1) { static uint16_t c=0; PutString("cpu2: %03d", 200,560,0b1111100000000000, (c++)/100); }
+ while(1) { static uint16_t c=0; PutString("cpu1counter: %d", 200,560,0b1111100000000000, (cpu1_counter)); }
}
+ */
+
//
// We want to get output to the screen as fast as possible!
@@ -62,7 +57,6 @@ void kernel_main(uint32_t initial_stack, int mp)
// our video memory
//
-
uint32_t vesa_physbase=vesa_init(0x8300,0x8400,0x7200);
@@ -72,8 +66,6 @@ void kernel_main(uint32_t initial_stack, int mp)
log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"initial esp: 0x%08X",initial_stack);
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"mp: %d",mp);
-
//
// Initialize other processors
//
@@ -81,10 +73,26 @@ void kernel_main(uint32_t initial_stack, int mp)
// Should support APCI in future too.
//
+
if(!init_mp()) panic(FOOLOS_MODULE_NAME,"Can not Find _MP_");
//
+ // Memory Init
+ //
+
+ // we know that here, the bootloader placed the mamory map!
+ mem_init(0x7c00+0x400,*((uint16_t *)(0x7c00+0x600)));
+
+
+ // paging (pass the vesa physbase address for identity mapping)
+ vmem_init(vesa_physbase);
+
+ while(1) {
+ PutString("cpu1counter: %d", 10,560,0b1111100000000000, (cpu1_counter));
+ cpu1_counter++;
+ }
+ //
// Setup PIC
//
// Do we nee this when using APIC?
@@ -103,17 +111,6 @@ void kernel_main(uint32_t initial_stack, int mp)
//
- // Memory Init
- //
-
- // we know that here, the bootloader placed the mamory map!
- mem_init(0x7c00+0x400,*((uint16_t *)(0x7c00+0x600)));
-
- // paging (pass the vesa physbase address for identity mapping)
- vmem_init(vesa_physbase);
-
-
- //
// Interrupts
//
@@ -136,8 +133,19 @@ void kernel_main(uint32_t initial_stack, int mp)
int_install_ir(38, 0b10001110, 0x08,&int_floppy_handler);
// now we can enable interrupts back again
- int_enable();
-
+// int_enable();
+
+ while(1) {
+ cpu1_counter++;
+ /*
+ static uint16_t c=0;
+ PutString("cpu1: A",20,560,0xffffff,0);
+ for(int c2=0;c2<0xffff;c2++);
+ PutString("cpu1: B",20,560,0xffffff,0);
+ for(int c2=0;c2<0xffff;c2++);
+ //PutString("cpu1: %03d", 20,560,0b1111100000000000, (c++)/100);
+ */
+ }
//
// Scan the PCI Bus