x86 error code size pushed?

Emulation of old PCs, PC hardware, or PC peripherals.

x86 error code size pushed?

Postby superfury » 2019-2-08 @ 11:15

What is the size of the error code that's pushed during x86 exceptions? Is it simply determined by the interrupt gate size? What about interrupt exceptions triggering task switches(using a task gate)? Does that result in a 32-bit error code or 16-bit error code being pushed on the stack?
superfury
l33t
 
Posts: 3230
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: x86 error code size pushed?

Postby Stenzek » 2019-2-08 @ 12:41

In my emulator I have it pushing the size corresponding to the gate type (same with the flags/CS:IP). Task switches depend on whether the incoming task is 32-bit or 16-bit. The Intel manuals cover the specifics in some detail if you look at the INT/INTO instruction.
Stenzek
Newbie
 
Posts: 58
Joined: 2017-12-08 @ 08:30

Re: x86 error code size pushed?

Postby superfury » 2019-2-08 @ 13:53

OK. That means at least that is implemented correctly in UniPCemu. There's still a bug somewhere(causing crashes in 32-bit Windows and Linux), but I can't find it (yet). The weird thing is that everything seems to work as is documented, but they still crash(on invalid descriptors, or invalid pointers(wrong segment loaded/stored into memory). In the case of Linux it's even worse: it's jumping to user space from kernel space, but the kernel descriptors only allow EIP in the range of 0-512MB(limit of 1GB, with it's base at 3GB, so the Linux kernel pretending to be an user-space program in kernel space with kernel privileges?).
superfury
l33t
 
Posts: 3230
Joined: 2014-3-08 @ 11:25
Location: Netherlands


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 1 guest