VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

If I compare 80386 and newer processor documentation to for example Bochs or other x86 emulators, I get a complex behaviour that is effectively not or very badly documented in the x86 programmer reference manuals?

There's many things affecting interrupts, gates and instructions:
- Gate sizes
- Operand size prefix
- Address size prefix
- Default bit for stack
- Default bit for code

There's simple documentation for how the prefixes work with the D-bit, but for basic instructions only (like in real mode).
But all other cases result in very badly documented behaviour.
For example, interrupt documentation says it pushes 'SS:eSP'.
What stack decrements are used for that (4 or 2 bytes increase, 2 or 4 bytes written)? What about the SP vs ESP being pushed? Zero or sign extension, or truncation if any?
And what about Virtual 8086 mode interrupts, which doesn't document what happens when 16-bit gates are being used at all?

The same for the issue of replacing an interrupt/trap gate with a call gate.

Then there's the reverse parts as well? RETF/IRET. Zero extending writing 32-bits EIP or stack pointer (ESP or SP) or leaving upper 16 bits unmodified (leaking them to user space)?

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