Page 2 of 2

Re: V8086 How to do it?

Posted: Sun Dec 15, 2013 9:11 pm
by PearOs
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.
Ok cool! I understand it now. Thank you. :)

Re: V8086 How to do it?

Posted: Mon Dec 16, 2013 3:07 pm
by Gigasoft
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?

Posted: Mon Dec 16, 2013 3:33 pm
by BMW
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?

Re: V8086 How to do it?

Posted: Mon Dec 16, 2013 4:06 pm
by Gigasoft
Obviously, you must switch to ring 0 first.

Re: V8086 How to do it?

Posted: Mon Dec 16, 2013 4:14 pm
by BMW
Gigasoft wrote:Obviously, you must switch to ring 0 first.
Gigasoft wrote:No, that won't do you any good at all.
?

Re: V8086 How to do it?

Posted: Mon Dec 16, 2013 7:04 pm
by PearOs
Edit: Nevermind I solved it. :D

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. :D

Thanks, Matt

[Solved] Re: V8086 How to do it?

Posted: Tue Dec 17, 2013 10:05 am
by PearOs
Nevermind, I got V8086 mode working. Thanks though guys. :)