From 5348a94a6e7a16a070c502c29db30a08253a99a3 Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Tue, 2 Sep 2014 14:53:09 +0200 Subject: Debugging paging problem on VirtualBox (VT-x) --- kernel/kernel.c | 64 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'kernel/kernel.c') 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,9 +73,25 @@ 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 // @@ -102,17 +110,6 @@ void kernel_main(uint32_t initial_stack, int mp) timer_init(); - // - // 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 -- cgit v1.2.3