Page 1 of 1

Software-tasking virtual8086 mode.

Posted: Tue Feb 05, 2008 1:24 pm
by lukem95
I posted someting about this in osdevelopment forum, but i got no replies, and as i've done some research and made some (fingers x-ed) progress, feel i should create a new topic and ask some more refined questions.

Ok...

Well im using tasking based largely on JamesM's tutorial, and i have a seperate stack for my userland tasks, and one for my kernel.

In v86 tasks i understand the stack must be below 1mb, as must the task.
This can be easily acheived, as i can create a new stack, and switch to it with fair ease.

I must then set the EFLAGS.VM register to 1, this is apparently easiest when returning from an interrupt.

My approach to this is to have a very simple executable loaded into my RamFS that simple calls a syscall which will initiate the v86 task. The syscall could get the task information from a extern task_t structure, update the EFLAGS and then switch to the now virtual8086 task.

Is there anything else i need to know? or have i got something wrong.

i can't find anything on v86 and software-task switching, and so that is based from the intel manuals and http://osdev.berlios.de/v86.html

If anybody has got it working and wouldn't mind giving me a pointer or two, or perhaps a quick IM/IRC/email chat, it would be much appreciated.

ciao, lukem95

Re: Software-tasking virtual8086 mode.

Posted: Tue Feb 05, 2008 2:33 pm
by Combuster
Please post in the correct forum, thanks.
lukem_95 wrote:i can't find anything on v86
You haven't searched
and software-task switching, and so that is based from the intel manuals and http://osdev.berlios.de/v86.html
Do you even need more than that?

Seriously, you seem to have enough to get started, you still complain you can't find anything while you have already found the manuals. If you can tell us what it is exactly that you do not understand we might provide more appropriate help. Right now it looks like you're hoping to get working code for free.

Posted: Tue Feb 05, 2008 2:46 pm
by lukem95
oh... i meant to post in theory :(

i have searched, i just have failed to understand.

when i said i cant find anything on v86, it was meant as "v86 AND software-tasking"... as on the wiki it says it is harder to implement.

i am also aware that the intel manuals probably contain everything i need, however i assumed i had to do something else in order to get it working, such as modifying (and then unmodifying when switching back) the kernels TSS or something.

what i was really asking, was how it is done differently on software-multitasking systems, as opposed to TSS switching ones. I am sorry if it came across noobish, and it may be. But i assure you i did search, and i have read everything i could find in the Intel manuals on the topic.

Posted: Tue Feb 05, 2008 3:58 pm
by Combuster
there is no real difference between implementing v8086 on hardware and software switching systems. In the first case you load the TSS with realmode-compatible stuff, and the vm bit, in the other you create a stack frame with the realmode segments on it, and again the vm bit set.

The only catch I can think of is that the when kernel is entered via an trap or interrupt gate, is that the realmode segment registers (and thus their offsets) remain in place, but as soon as you write the monitor you'd come across that as well, so you only get to it a bit earlier.

I don't know where you got that statement from. Most people here use software task switching, even those with working v8086.

Posted: Tue Feb 05, 2008 4:38 pm
by lukem95
Oh... i must have been overcomplicating things, thankyou for clearing that up