Stack fault/Page fault writing error code vs task switch/stack switch?

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

Stack fault/Page fault writing error code vs task switch/stack switch?

Postby superfury » 2017-11-01 @ 06:01

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? ... ?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.
Posts: 2679
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 3 guests