VM86 without TSS?

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
Shalted
Posts: 19
Joined: Wed Nov 07, 2007 12:09 am

VM86 without TSS?

Post by Shalted »

Is is possible to use the real mode bios interrupts, in V86 mode without a TSS. Is it even possible to enter V86 Mode without a TSS?
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

The TSS is required by the processor to store state when switching between virtual mode and protected mode. You need one per CPU, but they aren't too difficult to set up.
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Post by xyzzy »

As far as I know, you can get to virtual mode without one, but then you can't get back. Same for ring3
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Post by digo_rp »

Man I got VM86 under software taskswitching.

you can do almost all bios ints (Real Mode I mean), you can setup a vm86 task as a common PM32bits tasks, you just add the RM_DS, RM_ES, RM_FS, RM_GS to your stack layout.

if you want some example. email me.

[email protected]
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

AlexExtreme is right - you will get to ring3 / v86, but you cannot get back to ring 0 again - not ideal for a kernel!

You can certainly do it with software task switching, but you will need at least one TSS to store your SS0 and ESP0 values.

Cheers,
Adam
User avatar
lukem95
Member
Member
Posts: 536
Joined: Fri Aug 03, 2007 6:03 am
Location: Cambridge, UK

Post by lukem95 »

I'd like the see that example, and im sure others would benefit.

could you post a snippet? or upload it maybe?

lukem95
~ Lukem95 [ Cake ]
Release: 0.08b
Image
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Hi,

Not the example mentioned above, but if you look at my SVN repository for Caracal and CBoot, there is a working example of using v86 to establish available VESA information and to switch video modes. The code you want is in trunk/cboot/source/scheduler. In this path, the scheduler preamble is in cschedule.cpp (with necessary support code in cscheduler.asm) and v86 tasks are run from cv86.cpp.

Because this code is for a bootloader (which appears single-tasking!), cv86.asm contains code which 'fools' the calling function (CV86::RunV86() - look at the end of cv86.cpp) in to thinking that the V86 code is just any other function call, with some stack modification.

Using this system, all I have to do is write some 16 bit code and call it using RunV86 in order to execute BIOS functions - the scheduler takes care of the rest. You will notice that the v86 monitor is somewhat incomplete as the code relies pretty much on Virtual Mode Extensions at the moment - this dependency will be removed in the final version.

Any questions, please ask - note that the code is very much 'pre-production' at the moment.

Cheers,
Adam
[/url]
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

For all my ramblings, if you want to see what I'm actually trying to achieve, see this screenshots and explanation link.

Cheers,
Adam
Post Reply