in-kernel vm86 mode

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.
Post Reply
User avatar
xvedejas
Member
Member
Posts: 168
Joined: Thu Jun 04, 2009 5:01 pm

in-kernel vm86 mode

Post by xvedejas »

Vm86 mode is generally used for running tasks separate from the kernel, but what if I want to run some of my kernel's code in vm86 mode? What I need is for my kernel to send the BIOS an interrept (for VESA) then immediately return to protected mode. All the guides I have found for vm86 mode talk about ring 3 and setting up a TSS, I'm wondering if I can accomplish the same thing without this if I plan on doing it all in ring 0 and within my kernel.

The simplest answer is the best one. If you can point me to docs describing how to do what I ask, that works too, though I haven't found any yet :)

Thanks
Martijn
Posts: 22
Joined: Tue Feb 26, 2008 3:43 am
Location: The Netherlands

Re: in-kernel vm86 mode

Post by Martijn »

xvedejas wrote: All the guides I have found for vm86 mode talk about ring 3 and setting up a TSS, I'm wondering if I can accomplish the same thing without this if I plan on doing it all in ring 0 and within my kernel.
How about reading the Intel manuals.
Intel 3A: 15.2.1 Enabling Virtual-8086 Mode
...when checking privileged instructions, on page accesses, or when performing other permission checks. (Virtual-8086 mode always executes at CPL 3.)
Cognition
Member
Member
Posts: 191
Joined: Tue Apr 15, 2008 6:37 pm
Location: Gotham, Batmanistan

Re: in-kernel vm86 mode

Post by Cognition »

It's feasible to preform the task you're talking about in vm86 mode at CPL3, simply create a virtual monitor and set the TSS to operate at the proper address. Article wise it's almost completely covered in the Virtual Monitor page in the wiki here. The links at the bottom should provide you with code for some working examples, other then that the TSS is covered in depth in the Intel SDM.
Reserved for OEM use.
Post Reply