VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

What is the size of an error code pushed on the stack when handling a fault(e.g. Double fault) through a task gate in the IDT?

When does the CPU push 16 bits on the stack(descrementing (E)SP with 2)?

All 80386+ documentation only specifies '32-bit' handling for all protected mode examples, mentioning nothing about 16-bit protected mode (compatibility) and how it's handled on 32-bit processors? Such lack of documentation is extremely confusing.

Edit: Looking at Dosbox-X, it also seems to use the D/B-bit for that, but maybe it's actually bit 3 of the access rights(which also differentiates between a 80286 and 80386 TSS)?

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++

It must use bit 3 of the access rights byte for that, since the D/B-bit(used by UniPCemu and even Dosbox-X) must be zeroed for TSS descriptors(according to the 80386 programmer's reference manual's description of a 32-bit TSS descriptor). Otherwise, any such TSS-fault handler would push the wrong operand size error code on the stack, even on 32-bit faults(which can't be correct).

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