From fcfa7a7537ed76a63896ec5a9aa39cfc989d761c Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Wed, 3 Sep 2014 14:22:52 +0200 Subject: improved entry for application processors --- bochsrc | 2 +- kernel/kernel.c | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/bochsrc b/bochsrc index 66acc75..f6072ce 100644 --- a/bochsrc +++ b/bochsrc @@ -131,7 +131,7 @@ romimage: file=/home/miguel/opt/bochs-2.6.6/bios/BIOS-bochs-latest # 2.2.6 2.1Ghz Athlon XP with Linux 2.6/g++ 3.4 12 to 15 Mips # 2.0.1 1.6Ghz Intel P4 with Win2000/g++ 3.3 5 to 7 Mips #======================================================================= -cpu: count=2, ips=10000000 #, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def" +cpu: count=3, ips=10000000 #, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="msrs.def" #======================================================================= # CPUID: diff --git a/kernel/kernel.c b/kernel/kernel.c index b2af08d..fdb43ba 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -19,11 +19,10 @@ volatile uint8_t proc; void kernel_ap() { uint32_t cpu_counter=0; - uint32_t ebp; - asm volatile("mov %%ebp,%0":"=r"(ebp)); - int proc=ebp-0xffffff; - proc/=-0x400; - while(1)PutString("%d", proc*100,580,0b1111100000000000, (cpu_counter++)); + proc++; + uint8_t p=proc; + + while(1)PutString("%d", p*100,580,0b1111100000000000, (cpu_counter++)); } // // KERNEL MAIN @@ -37,8 +36,7 @@ void kernel_main(uint32_t initial_stack, int mp) // catch the APs (Application Processors) if(mp==1) { - uint32_t ebp=0xffffff-proc*0x400; - proc++; + uint32_t ebp=pmmngr_alloc_block()+4095; asm volatile("mov %0, %%ebp"::"r"(ebp)); asm volatile("mov %ebp, %esp"); @@ -117,6 +115,7 @@ void kernel_main(uint32_t initial_stack, int mp) // we know that here, the bootloader placed the mamory map! mem_init(0x7c00+0x400,*((uint16_t *)(0x7c00+0x600))); + // // Initialize other processors (run this before entering paged mode) // @@ -149,11 +148,11 @@ void kernel_main(uint32_t initial_stack, int mp) ///////////////////// - // paging (pass the vesa physbase address for identity mapping) vmem_init(vesa_physbase); + // // Interrupts // @@ -213,7 +212,7 @@ void kernel_main(uint32_t initial_stack, int mp) // round robin style. // - task_init(); + task_init(); // -- cgit v1.2.3