Re:Ways of Implementing a System Call
by anaisbetts on Friday January 17, 2020 @01:42AM
(#22072417)
One of the ways that many operating systems (I'm fairly certain that Windows did this at one point) implemented syscalls long ago was to execute an illegal instruction, because this was the fastest way at the time to transition to kernel mode. x86 even has a specific opcode that is guaranteed to never be used aka always be an illegal instruction
[ Parent
| on HN ]
x86 has two: UD1 and UD2. Sadly, no one can agree on the length of UD1, even though everyone agrees that it’s illegal. UD2 is well behaved.