VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

What is the correct behaviour of the 32-bit pop of EIP when returning from protected mode to V86 mode?
I see that Dosbox masks EIP with 0xFFFF, so the top 16 bits are truncated. But PCem doesn't truncate it at all?
I see that V86mon in UniPCemu tries to return to 200XD in it's very first IRETD to V86 mode, so would that return to address XDh instead of 200XD(according to Dosbox) or X D(According to PCem and perhaps others(unchecked source code of other emulators))?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 1 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

OK. Turns out neither is correct: EIP isn't truncated in PM to VM IRETD. But what neither emulators(Dosbox AND PCem) do is check EIP against the new CS limits and throw a #GP(0) fault if it does(on the IRETD, not on instruction fetch(PCem) or invalidly truncating and not faulting(Dosbox)).

Just implemented that in UniPCemu.
Also noticed that #GP(0) wasn't thrown for CS:EIP limit violations on CS loads(e.g. JMPF/CALLF/RETF/INT/IRET loading CS) in Real and V86 mode.
Perhaps that's what was causing software like CheckIt Diagnostics and WhatVGA to fail in real mode?
Edit: Nope. The bugs still occur(runtime error 200(WhatVGA) at IP=00AD and runtime error R6003 - integer divide by 0(CheckIt)) 🙁

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 2 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

Well, at least V86mon doesn't double fault anymore. Now i'm getting a Fault/Exception #13(0000)@0030:008B after which it halts the whole system.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 3 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

Windows 98 First Edition still crashes during normal boot, but I see it crashing executing segment 1E? That's kind of weird for real mode, since it's in the middle of the IVT?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 4 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

OK. Segment 1E is kind of strange in real mode, as that's in the middle of the IVT. So the issue is in the place it's called, which is at segment 70h. But isn't segment 70h MSDOS.SYS usually? Or in Windows 9x's case, definitely IO.SYS(since it doesn't have MSDOS.SYS as a boot file).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io

Reply 5 of 5, by superfury

User metadata
Rank l33t++
Rank
l33t++

OK. The issue with V86mon was that the executable was corrupted in the disk image. That at least solves that issue 😁
So that means that the Pentium is at least running fine in V86 mode and VME's V86 mode.

So there's still some strange issue with real mode and various software(CheckIt, WhatVGA and PC-Check 6).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io