VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

I notice that when I change the interrupt handler's Present bit of 0 to trigger an #NP exception instead of a #GP exception, EMM386 starts hanging during boot? So it requires non-present descriptors to cause a #GP for some odd reason, instead of the documented #NP?

Anyone knows what's happening or going wrong?

See CPU_ProtectedModeInterrupt() in https://bitbucket.org/superfury/unipcemu/src/ … ion.c?at=master

Edit: Just modified the interrupt handling to act like Bochs: first plain #GP(IDTsel+2+EXT) faulting on the privilege level mismatch(on INT) and invalid descriptor type(type part of the field), then after that checking for the present bit(why is that done after the first two?) which #NP(IDTsel+2+EXT) faults if errored out?

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

Reply 1 of 1, by superfury

User metadata
Rank l33t++
Rank
l33t++

Just adjusted the remainder of interrupt handling, stack switching and stack access checking to also follow the correct order. Also throwing proper stack faults instead of #SS(0) (#SS(sel|EXT) instead).

Also modified incorrect SS segment loads when switching stacks to a higher privilege(interrupts) to properly set the EXT bit for the fault and throw #TS(selector|EXT) properly.

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