Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The term to search for is "heaven's gate". TL;DR: Intel processors can, in usermode, switch between 32-bit and 64-bit mode.

Note that the concept of a process is irrelevant: processes don't exist to Intel processors. There was a concept called a "task" early on in I believe the 286 line, but nowadays all OSes just set up a single task segment on the CPU and do all of the context switching via other means, because it simply wound up being faster anyway. The processor just has tons of registers that you can flip around, and being able to switch between protected mode and long mode is a property of the code segment currently being executed (IIRC) which is something you can jump between in usermode using a far call. (And this is, as far as I know, just about the only way in which x86 segments remain relevant today.)



When I said processes, my impression was that the kernel was responsible for switching the CPU into / out of 32-bit mode through a privileged operation (ie that’s the process boundary). Turns out that’s not the case and it’s in the unprivileged CS register which can be mutated calling jmp/call with a target segment set to 0x33.

Thanks for correcting me!

[1] https://stackoverflow.com/questions/24113729/switch-from-32b...


I assume this one for heaven's gate: https://www.alex-ionescu.com/closing-heavens-gate/

But that's very windows specific, I think the general term is jumping between long mode and protected mode?


I'm not sure exactly where the term comes from, but I've seen people use it to refer to doing the same thing on Linux, too. (IIRC, the code segments for protected mode and long mode also happen to be the same on Windows and Linux. Not sure why exactly.)


Intel processors can, as opposed to AMD processors? or both can?


Sorry, both.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: