5 ms·
Fun fact, not only can you use iret to return to user-mode from kernel-mode and kernel-mode from kernel-mode (as footnote 5 mentions), you can also use iret to
by MarkSweep 7y ago
Fun fact, not only can you use iret to return to user-mode from kernel-mode and kernel-mode from kernel-mode (as footnote 5 mentions), you can also use iret to return from user-mode to user-mode. It is a handy way to restore RIP, RSP, and RFLAGS at the same time. .NET CoreCLR uses it during exception handling on Unix:
https://github.com/dotnet/runtime/blob/4db72366e8e49c30d7aa6d2cc920cf063fb911ea/src/coreclr/src/pal/src/arch/amd64/context2.S#L183 https://github.com/dotnet/runtime/blob/4db72366e8e49c30d7aa6...