summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-03 14:22:52 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-03 14:22:52 +0200
commitfcfa7a7537ed76a63896ec5a9aa39cfc989d761c (patch)
tree791639693fb21161aa1be99d1c23425f5120b66b /kernel/kernel.c
parenta6efba7a22b85c0556c8c262f3bbcaf7bda7ddfa (diff)
improved entry for application processors
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c17
1 files changed, 8 insertions, 9 deletions
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();
//