Hello,
I am currently making SMP code for my OS. It currently sends an SIPI. I was wondering how I can check if the CPU has started in QEMU.
Thanks,
nexos
Testing if a Startup IPI worked
Re: Testing if a Startup IPI worked
When you wake an AP, it will start to execute your code. The obvious solution is to make CPU to report the status. For example: set a flag somewhere, retrieve and print Local APIC Id.
If you have not yet written trampoline code that switches it from Real mode to something more convenient, you can point it at 16-bit code containing an infinite loop or HLT instruction. Then examine in QEMU monitor, if CPU has reached that.
If you have not yet written trampoline code that switches it from Real mode to something more convenient, you can point it at 16-bit code containing an infinite loop or HLT instruction. Then examine in QEMU monitor, if CPU has reached that.
If something looks overcomplicated, most likely it is.
Re: Testing if a Startup IPI worked
Cores that are not running code will all be halted at the same instruction (in the BIOS ROM). In qemu this appears to be 0xfd0ca.
In the qemu monitor use the commands
cpu 2 (for example)
info registers
to inspect the registers for any core. If %eip is other than the above value then it's running.
In the qemu monitor use the commands
cpu 2 (for example)
info registers
to inspect the registers for any core. If %eip is other than the above value then it's running.