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.
BMW wrote:Ok, the INT/IRET should work. When an interrupt occurs, the segment registers are pushed onto the stack, and popped when IRET is called. You will have to modify the values of the segment registers on the stack so that when IRET is called, the values for the segment registers have a requested privilege level (RPL) of 0 (ring 0), in order to return in ring 0.
No, that won't do you any good at all. You want to return to where you were before entering Virtual 8086 mode. Therefore, you just restore ESP to the value it had before (which you should have saved in the ESP0 field in your TSS) and continue onwards with what you were doing.
Gigasoft wrote:No, that won't do you any good at all. You want to return to where you were before entering Virtual 8086 mode. Therefore, you just restore ESP to the value it had before (which you should have saved in the ESP0 field in your TSS) and continue onwards with what you were doing.
And how on earth would that cause a switch from ring 3 to ring 0?
Ok but I have a problem now that I am in user mode. I did a "hlt" after I get into User mode and all of a sudden I start seeing Bochs printing out that its allcocating blocks very quickly, Its not calling a ISR or anything so I wonder what the issue is? Maybe my Kernel stack wasn't set?
Edit: Ok I tracked it down. When I did a hlt it was infact calling my ISR handler. But I have some code in there that makes sure interrupts are disabled and I believe that the processor is still in Ring3 when my ISR code is called. How do I stop this? I don't want my code to be ran in Ring3 when my ISR Handler is called.
Edit: Nevermind, did some more research and fixed that problem too.