SMP query
Posted: Fri Mar 20, 2009 1:21 pm
Hi,
First of all thank you all for helping me out so far. I have managed to finally boot all the APs and jump them into protected mode [had to drop the idea of doing it with NASM.. GAS now! ]. The CPUs now print out a string to show they're up and then they just spin in an infinite loop for now.I want to work on it further. Here are a few doubts. Hope they dont sound too silly..
1. The APs currently, due to the trampoline code, have a common stack. I should allot different stacks to the APs, rite? So can I do that in the C code before they start to spin, using inline assembly? If so, then I can use the local apic ID register to identify which cpu it is and use that ID to map a different area in memory for stack for each CPU... Please do correct me, if I seem to be going wrong in the thought process. Or is there some other way to do it?
2. As of now the APs jus enter an infinite loop --> while (1) .. I know this wrong.. And it has to be corrected.. What is the usual way of doing this? And is there a way that the processor can be put to sleep and later be able to wake it up using an IPI, instead of just putting it in a loop polling a memory location?
3. My next step would be to setup interrupts. And use IPIs to communicate among processors.. something like a ping-pong for now -> BSP sends IPI to specific APs and it replies with.. say a "Hello World" or something like that... What all should I be careful about and what all needs to be setup before I can do that.
Hope you guys can help.
First of all thank you all for helping me out so far. I have managed to finally boot all the APs and jump them into protected mode [had to drop the idea of doing it with NASM.. GAS now! ]. The CPUs now print out a string to show they're up and then they just spin in an infinite loop for now.I want to work on it further. Here are a few doubts. Hope they dont sound too silly..
1. The APs currently, due to the trampoline code, have a common stack. I should allot different stacks to the APs, rite? So can I do that in the C code before they start to spin, using inline assembly? If so, then I can use the local apic ID register to identify which cpu it is and use that ID to map a different area in memory for stack for each CPU... Please do correct me, if I seem to be going wrong in the thought process. Or is there some other way to do it?
2. As of now the APs jus enter an infinite loop --> while (1) .. I know this wrong.. And it has to be corrected.. What is the usual way of doing this? And is there a way that the processor can be put to sleep and later be able to wake it up using an IPI, instead of just putting it in a loop polling a memory location?
3. My next step would be to setup interrupts. And use IPIs to communicate among processors.. something like a ping-pong for now -> BSP sends IPI to specific APs and it replies with.. say a "Hello World" or something like that... What all should I be careful about and what all needs to be setup before I can do that.
Hope you guys can help.