vm86 and software task switching
Posted: Sat Jun 26, 2004 11:00 pm
Hi,
I've recently tried to implement vm86 mode in my software task switching code. However, I've run into a problem. vm86 requires accurate segments (for CS and the like) before it can execute code and read data properly. These are imcompatible with pMode, so when I try to switch to a vm86 task, bochs complains that the new segment value (for 16 bit) is past the GDT limit, as heres my task switching code:
[code]
_ChangeTasks:
cli
push ds
push es
push fs
push gs
push eax
push ebx
push ecx
push edx
push esi
push edi
push ebp
mov eax,0x10
mov ds,eax
mov es,eax
mov fs,eax
mov gs,eax
mov ss,eax
mov ebx,[_currentTask]
shl ebx,3
lea esi,[_stackPointers]
mov [ds:ebx+esi],esp
mov [ds:ebx+esi+4],ss
mov ebx,[_nextTask]
mov [_currentTask],ebx
shl ebx,3
mov esp,[ds:ebx+esi]
mov ss,[ds:ebx+esi+4]
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
pop gs
pop fs
pop es
pop ds
sti
ret
[/code]
How can I prevent this, and has anyone implemented a vm86 task in a software task switcher?
Also, do I need a PL3 code and data selectors for switching to a vm86 task?
CloudNine
I've recently tried to implement vm86 mode in my software task switching code. However, I've run into a problem. vm86 requires accurate segments (for CS and the like) before it can execute code and read data properly. These are imcompatible with pMode, so when I try to switch to a vm86 task, bochs complains that the new segment value (for 16 bit) is past the GDT limit, as heres my task switching code:
[code]
_ChangeTasks:
cli
push ds
push es
push fs
push gs
push eax
push ebx
push ecx
push edx
push esi
push edi
push ebp
mov eax,0x10
mov ds,eax
mov es,eax
mov fs,eax
mov gs,eax
mov ss,eax
mov ebx,[_currentTask]
shl ebx,3
lea esi,[_stackPointers]
mov [ds:ebx+esi],esp
mov [ds:ebx+esi+4],ss
mov ebx,[_nextTask]
mov [_currentTask],ebx
shl ebx,3
mov esp,[ds:ebx+esi]
mov ss,[ds:ebx+esi+4]
pop ebp
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
pop gs
pop fs
pop es
pop ds
sti
ret
[/code]
How can I prevent this, and has anyone implemented a vm86 task in a software task switcher?
Also, do I need a PL3 code and data selectors for switching to a vm86 task?
CloudNine