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.
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...
hm, I was a bit bored so I looked up the pseudo-code for iret in the second intel manual 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.
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
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."
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...
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.