Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I'm trying to get the second processor in my system to boot but I can't really make it do anything besides hanging.
So far I've managed to parse the SMP table seemingly correctly. The only thing I didn't get was the Apic ID specified for each processor entry. When I try to signal the Apic specified by that ID nothing happens, but if I instead signal by the logical processor number then at least it hangs
Next I've asserted and deasserted init ipi's. Then if I try to send the startup ipi with the bootpage loaded(0x1000) it just hangs.
You should use Bochs - there is a prebuilt binary which supports multiple CPUs. You can compile your own that also includes a debugger which is very useful to have.
The code snippet you provided doesn't show us how the processors actually get started - which can be the actual cause of the bug.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
I've finally got the second processor started and am just having a few(probably solvable) problems with the gdt, but so far so good.
Seems Bochs(I haven't tested on a real machine) needs to have the physical bootpage number multiplied by 10 for it to work. If I load the code at address 0x8000, i must supply 80 in the startup ipi vector for it to hit the right address
Laksen wrote:Seems Bochs(I haven't tested on a real machine) needs to have the physical bootpage number multiplied by 10 for it to work. If I load the code at address 0x8000, i must supply 80 in the startup ipi vector for it to hit the right address
On both Bochs and real (Pentium or later) machines, the vector in the startup IPI is shifted left 8 times and loaded into CS, and IP is cleared.
For e.g. with 0x80 in the startup IPI vector, the (real mode) starting address (CS:IP) will be 0x8000:0x0000 (which is actually 0x00080000 as a flat 32-bit physical address).
I'm guessing you're getting real mode addressing mixed up with protected mode addressing...
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.