VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

How does a x86 CPU handle those? What happens when it cannot push the error code on the new stack? Triple fault? Is data written to memory, besides the task switch segment contents?

Edit: There's also the strange issue of task switches/stack switching vs fault status? When is the last fault that's been raised(if any) cleared during task switches?

There seems to be valid faults being raised after task switching loading segment registers and their checking, but apparently pushing to an invalid stack(the error code) seems to cause a double/triple fault? So is the fault status cleared when switching tasks, and if so, at what point? UniPCemu's currently clearing the fault status after loading registers, but before performing all checks and actually loading the segments and pushing the fault code to the stack(if any) after that, following normal stack fault rules?

https://bitbucket.org/superfury/unipcemu/src/ … ing.c?at=master

Anyone knows how to properly handle those cases? When is the fault status cleared(thus no longer running double/triple faults on the very first fault) during task switches? What happens exactly when switching to a valid stack during a stack switch(e.g. by privilege level change within a task, e.g. Virtual 8086 monitor), but the stack pointer can't (fully) push the fault code on the stack? Is the fault code lost forever? Is it restartable?

Of course the same stuff as stack faults apply to page fault within the same context.

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