congratulations gerryg400! YOU hit the boom!
the solution is so simple:
Code: Select all
....
kbd_init();
wait = false;
} else {
vga_prt( "A" );
//cpu_init();
while( wait );
}
vga_prt( "B" );
//sched();
while(1);
}
Nothing different right? And i even turned on -O2!
the key problem is, vga_prt is with no lock! the reason is, when the wait is set false by bsp, all aps go to print at a same time to print "B", (but "A" is printed seperately, because bsp release them seperately, with an allocation between them. ), so we can see only one 'B'.
how i found it is just because i redefined page table in bootloader to map a larger space for kernel at the beginning, and i suddenly see 7 As and 3 Bs... so, you know...
gerryg400 wrote:Oh. I thought you were running on bare metal ! Which emulator are you using ?
i don't have a bare metal, u will know that if u are in china. chinese students even professors have little device for their research, not like u. china is not poor now, but its people is even poorer than before. i love my country more than u can feel, but i hate its political environment. u think China is People's Republic? i will tell u NO!
but i use bochs for multi-core, sometimes virtualbox, qemu just for single core because it's really slow for SMP.
If I were trying to debug this problem I would disassemble the executable and examine it. Can you post the disassembled executable ?
i disasm sometimes but not often, since i would combine printing things and bochsdbg. disasm is not a good way as your kernel grows. but combine symbol table and bochsdbg (breakpoint, disassemble little piece of code) would be better. i don't have better way.
keeping the whole kernel arch and its logic in your brain clearly, will help a lot i think.
thx