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 --- kernel/kernel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'kernel/kernel.c') 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