V8086 How to do it?

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.
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: V8086 How to do it?

Post 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. :)
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: V8086 How to do it?

Post 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.
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Re: V8086 How to do it?

Post 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?
Currently developing Lithium OS (LiOS).

Recursive paging saves lives.
"I want to change the world, but they won't give me the source code."
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: V8086 How to do it?

Post by Gigasoft »

Obviously, you must switch to ring 0 first.
User avatar
BMW
Member
Member
Posts: 286
Joined: Mon Nov 05, 2012 8:31 pm
Location: New Zealand

Re: V8086 How to do it?

Post by BMW »

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."
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: V8086 How to do it?

Post 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
Attachments
BochsScreenshot3.png
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

[Solved] Re: V8086 How to do it?

Post by PearOs »

Nevermind, I got V8086 mode working. Thanks though guys. :)
Post Reply