Page 1 of 1

Virtual-8086-Mode and Task linking

Posted: Sat May 20, 2006 2:42 pm
by bluecode
hi,

I'm currently implementing the ability to execute BIOS interrupts within my 32bit protected-mode OS. Today I came across the idea, that I could use one tss for my kernel and one for my virtual-8086 task. At first I would safe the kernel's state in the kernel TSS in order to restart the kernel task. Then I would switch to the virtual-8086 task via an iret with the NT flag set (and set the v8086 tss's backlink to the kernel's tss descriptor). Then my virtual-8086-task executes the interrupt and does an iret which would invoke the kernel again and the kernel could go on as if nothing happend... :)
Is this task linking with virtual-8086-mode possible? I read the intel docs, but they did not state anything virtual-8086-mode specific...

Re:Virtual-8086-Mode and Task linking

Posted: Sat May 20, 2006 2:59 pm
by bluecode
hm, I was a bit bored so I looked up the pseudo-code for iret in the second intel manual :P and found out, that it should not be possible, if iret is really executed in the way stated in the intel manual

sorry for disturbing you. I promise I will next time first look in that Intel Manual, too.

Re:Virtual-8086-Mode and Task linking

Posted: Sat May 20, 2006 3:06 pm
by mystran
I'm not quite sure using the TSS stuff is worth the trouble anyway.

TSS basicly solves two problems:
1) giving you a place to put kernel stack pointer (esp0)
2) some other problem that I'm sure even Intel's engineers have long forgotten

Re:Virtual-8086-Mode and Task linking

Posted: Sat May 20, 2006 3:15 pm
by paulbarker
That second problem was probably created by a management meeting at Intel:

"Hey guys, I'm thinking kernel development is just too easy these days. Lets give them yet another horribly packed structure that has to be filled in bit by bit."

Re:Virtual-8086-Mode and Task linking

Posted: Sat May 20, 2006 3:43 pm
by bluecode
mystran wrote: I'm not quite sure using the TSS stuff is worth the trouble anyway.
Well, I don't want to use hardware taskswitching for the rest of the system either, but for that part I thought it would be handy. But it's not working anyway...

Re:Virtual-8086-Mode and Task linking

Posted: Sat May 20, 2006 5:10 pm
by crackers
Well I'm using this method in my OS and it's working fine. I've task gate descriptors in IDT so all interrupts works as seperate tasks. When I get timer interrupt I'm setting TSS data of task I want to switch to and execute iret instruction.

Re:Virtual-8086-Mode and Task linking

Posted: Sun May 21, 2006 5:12 am
by bluecode
hm,

ok, I didn't come up with the task gates in the idt... Thanks crackers :) I'll try that.