2 ms·
IPC is not necessary: you can in fact jump from 32-bit code to 64-bit code using a special kind of FAR call across code segments! This is what the new Wine-on-W
by jchw 3y ago
IPC is not necessary: you can in fact jump from 32-bit code to 64-bit code using a special kind of FAR call across code segments! This is what the new Wine-on-Wine64 is doing. I'm mentioning Windows syscalls because Wine implements the Windows syscalls by redirecting them to UNIX libraries, and it happens to be using the same exact idea as how Windows syscalls go from Windows-on-Windows64 for calling 64-bit libraries in Wine-on-Wine64. What is a syscall in Windows is a library call in Wine, and they happen to use a similar mechanism. (I mentioned elsewhere in the thread that I realize this is not a case where things are exactly the same, but it's closer related than I think you're giving it credit.)
As I understand it, the way that AMD64/EM64T processors actually evolved, rather than having completely separate "modes" for real mode/protected mode/long mode, instead, internally, the processors are more-or-less just masking features on and off. So jumping from 32-bit to 64-bit code isn't actually impossible, in fact it's obviously necessary for 32-bit code to be able to make syscalls in the first place, but what might not be clear is that at least on AMD64, you can do this jump purely in usermode, too.
The funny abilities of x86 processors even allow you to mix and match a bit with the different modes; For example, the old Linux x32 ABI[1], or Unreal Mode[2], not to mention the fact that older protected mode OSes (like Win9x) would often thunk to real mode for legacy drivers.
[1]: https://en.wikipedia.org/wiki/X32_ABI https://en.wikipedia.org/wiki/X32_ABI
[2]: https://en.wikipedia.org/wiki/Unreal_mode https://en.wikipedia.org/wiki/Unreal_mode