Korona wrote:
Yes, just set the ESP and SS values.
There is a single cases where you need to use hardware context switching, even when your OS performs software context switching during normal operation, and that is the NMI and MCE handlers (when using the syscall instruction). The reason for that is that hardware switching can atomically change the stack even when there is no ring transition. syscall requires you to manually switch to the user mode stack while you're still in supervisor mode. After you did that, NMIs and MCEs will run on this user mode stack if they are not handled by a task gate.
I will not use the syscall instruction, I will have not any problem, will I have (maybe something that I didn't understand)?