Ok cool! I understand it now. Thank you.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.
V8086 How to do it?
Re: V8086 How to do it?
Re: V8086 How to do it?
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.
Re: V8086 How to do it?
And how on earth would that cause a switch from ring 3 to ring 0?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.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: V8086 How to do it?
Obviously, you must switch to ring 0 first.
Re: V8086 How to do it?
Gigasoft wrote:Obviously, you must switch to ring 0 first.
?Gigasoft wrote:No, that won't do you any good at all.
Currently developing Lithium OS (LiOS).
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Re: V8086 How to do it?
Edit: Nevermind I solved it.
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.
Thanks, Matt
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.
Thanks, Matt
[Solved] Re: V8086 How to do it?
Nevermind, I got V8086 mode working. Thanks though guys.