Page 1 of 1

VM86 without TSS?

Posted: Sat Jan 26, 2008 6:14 pm
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?

Posted: Sat Jan 26, 2008 7:16 pm
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.

Posted: Sun Jan 27, 2008 2:13 am
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

Posted: Sun Jan 27, 2008 9:17 am
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]

Posted: Sun Jan 27, 2008 3:38 pm
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

Posted: Tue Jan 29, 2008 3:21 pm
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

Posted: Wed Jan 30, 2008 4:05 am
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]

Posted: Wed Jan 30, 2008 4:52 am
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