From 3bac6dd02d640923646b8ad988f509f47adab57f Mon Sep 17 00:00:00 2001 From: Michal Idziorek Date: Sat, 16 May 2015 20:42:37 +0200 Subject: working on smp support, strange things happening!? --- kernel/smp.c | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'kernel/smp.c') diff --git a/kernel/smp.c b/kernel/smp.c index 8d122ee..f776c72 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -16,19 +16,22 @@ uint32_t c1,c2,c3; volatile uint8_t proc; uint32_t cpu_counter[SMP_MAX_PROC]; +extern + void smp_main() { - /// TODO - /////// SYMMETRIC MULTIPROCESSING, APS get caought here, move it away /// - // catch the APs (Application Processors) -// if(mp==1) - { - uint32_t ebp=pmmngr_alloc_block()+4095; - asm volatile("mov %0, %%ebp"::"r"(ebp)); - asm volatile("mov %ebp, %esp"); - asm volatile("jmp kernel_ap"); - } + // int_install(); + // x86_int_enable(); + switch_to_user_mode(); + + while(1); + + uint32_t ebp=pmmngr_alloc_block()+4095; + + asm volatile("mov %0, %%ebp"::"r"(ebp)); + asm volatile("mov %ebp, %esp"); + asm volatile("jmp kernel_ap"); proc=c1=c2=c3=0; for(int i=0;ilocal_apic_address+FOOLOS_APIC_SPUR_INT; - *reg=0xffffffff; // all bits 1 and interrupt 255 +// *reg=0xffffffff; // all bits 1 and interrupt 255 for(int i=0;iprocessors;i++) { @@ -90,12 +91,20 @@ void smp_start_aps(smp_processors *pros,uint8_t *start_sel) *reg=(5<<8)|(1<<14); // 101 INIT // do we really neet this? + // TODO!! // todo: use some real sleep (not implemented yet :( ) //sleep(30); // start proc 0x7 = 0x7000; etc.. *reg=(6<<8)|(1<<14)|0x7; // 110 SIPI + + //bsp (boot processor) enables its local apic + uint32_t *reg=pros->local_apic_address+FOOLOS_APIC_SPUR_INT; + // *reg=0xffffffff; // all bits 1 and interrupt 255 + + } } + -- cgit v1.2.3