Re:Writing an OS in Rust: Returning from Exceptions
by amluto on Wednesday September 21, 2016 @06:21PM
(#12552795)
No. In fact, that hardware support is mandatory. The SP0 field is used unconditionally on a cross-privilege exception.
Sadly, AMD64 came up with a terrible design for SYSCALL, and an exception right after SYSCALL will not automatically switch stacks. The result is a big mess.
There's hardware support to help with this; see "Task state segment" (16 and 32 bit x86 only, amd64 is different).