x86 #SS vs #GP for all different SS loads?

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

x86 #SS vs #GP for all different SS loads?

Postby superfury » 2019-5-26 @ 02:22

What happens when a SS segment register faults during any of the following operations:
- Task switching
- MOV SS instruction
- LSS instruction
- Privilege level changes(e.g. during interrupts/call gates)

I currently have it implemented to always fault as #SS(selector), except for invalid types to load? Is that even correct behaviour? Should #GP happen instead of #SS in some cases but not others(e.g. MOV SS/LSS vs the other cases)?

As far as I can find, #SS(selector) only happens with all Present bits being 0 checks and some checks during task switching? Is that correct?
Edit: Also, the #TS happens instead of #GP during stack switching to a higher privilege level(both CALL and INT)?

So there's 3 cases for kinds of faults?
- Task switching (#SS(for all cases))
- Privilege level changes (to a higher privilege level) (#TS and #SS(for present bit only))
- All other cases (#GP and #SS(for present bit only))
Edit: Apparently, Task switching has #SS for not present only. Otherwise, #TS(stacksegment)?
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 2 guests