Entering vm86 Mode?
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Entering vm86 Mode?
check the intel manual (chapter about 8086 emulation) to be 100% sure. Here's my local cache version:
push-order is (--GS)(--FS)(--DS)(--ES)(--SS)(ESP)(FLaGZ)(--CS)(EIP)
Note that segment registers are pushed as 32 bits words. The corresponding code would be
push-order is (--GS)(--FS)(--DS)(--ES)(--SS)(ESP)(FLaGZ)(--CS)(EIP)
Note that segment registers are pushed as 32 bits words. The corresponding code would be
Code: Select all
xor eax,eax
mov ax, *s
push eax
Calling BIOS Interrupts from vm86-Mode?
..
Last edited by Perica on Sun Dec 03, 2006 9:00 pm, edited 1 time in total.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Entering vm86 Mode?
i'm not convinced it's a very good idea, but i'll try to help nonetheless (you must have real good reason not to use realmode INT13 and bios memcopy INT15 features ... i don't want to start a flame war )
what you should do is read [requested_interrupt*4] to get the actual CS:IP for the interrupt you want to call, and set the appropriate values on your pmode stack for the V86 invokation.
transferring values in registers (for int arguments) shouldn't be hard.
What you should take care of is what the real-mode interrupt will do when its work is complete. I suggest you add the address of a HLT instruction on the rmode stack so that when INT13 will try to call IRET, it will branch on a HLT instruction, which is prohibited in v86mode --> it will raise a GPF that you'll be able to use to finish the V86 call...
what you should do is read [requested_interrupt*4] to get the actual CS:IP for the interrupt you want to call, and set the appropriate values on your pmode stack for the V86 invokation.
transferring values in registers (for int arguments) shouldn't be hard.
What you should take care of is what the real-mode interrupt will do when its work is complete. I suggest you add the address of a HLT instruction on the rmode stack so that when INT13 will try to call IRET, it will branch on a HLT instruction, which is prohibited in v86mode --> it will raise a GPF that you'll be able to use to finish the V86 call...
Re:Entering vm86 Mode?
At the risk of starting a flame war...
Don't bother using V86 mode in a boot sector if all you're doing it loading from disk into extended memory. Unreal mode will be enough. There are tutorials around which will tell you how to do this. Briefly, you need to:
This is a lot easier and more reliable than setting V86 mode inside your boot sector.
Don't bother using V86 mode in a boot sector if all you're doing it loading from disk into extended memory. Unreal mode will be enough. There are tutorials around which will tell you how to do this. Briefly, you need to:
- set up a GDT with at least a data segment whose base is zero and whose limit is 4GB
- set CR0.PE
- load FS with your data selector
- set FS to zero
- clear CR0.PE
This is a lot easier and more reliable than setting V86 mode inside your boot sector.
Re:Entering vm86 Mode?
..
Last edited by Perica on Sun Dec 03, 2006 9:00 pm, edited 1 time in total.
Re:Entering vm86 Mode?
Really? I could mention an entire generation of computer games which cast that into doubt.Perica Senjak wrote:UnrealMode on the other hand isn't a very good idea (It can cause errors in your code, and also may not work on some machines)
Yes; use the O32 prefix on REP MOVSD (or is it A32? a quick experiment could verify that). If you're not happy with unreal mode then could I suggest the INT 15h services which Pype mentioned earlier?and i don't see how you could move something into upper memory from UnrealMode using movsb/movsw/movsd, because in RealMode those instructions use 16-Bit Registers (si, di etc.); Is there a way around this? If so, how would it be done?