32-bit kernel, 64-bit applications

32-bit kernel, 64-bit applications, that is the most mysterious thing to me, especially when I first got in touch with Mac OS X Leopard, ten years ago. How can a computer running under 32-bit mode executes 64-bit applications? That is quite rare for modern computing systems. But when I was a teenager, this kind of things were quite often, especially when I was sitting in front of MS-DOS 6.22 with full of fantasy dreams. So many applications, especially game applications would bring up the processor from the real mode to the 32-bit mode to utilise the 8MB system memory. Even under Windows 3.x, with help of Win32s API pack, several 32-bit applications would also be executed under 16-bit Windows. When the days show the sunshine towards Windows 9x, 16-bit drivers could also hook the 32-bit system backwards to real mode, and then with that hook the system could get back to its 32-bit world. But those are the stories of the passed, what about a 32-bit kernel running 64-bit and 32-bit applications? It seems almost impossible for AMD64 architecture, one could easily figure out the actual architecture lies on the Long Mode, especially for its 64-bit sub-mode. Because the compatibility mode is just an associated mode, provided as a replacement of x86 engine found on Itanium processor. AMD64 is not 64-bit version of x86 or IA-32, it is just itself, provided for competing against Itanium architecture, and won!




What is the real 64-bit version of IA-32? That might be the abandoned project ever kept secret in Intel, Project Yamhill. For years, I repeated embrace a question, why Microsoft had no lust to release a third 64-bit version of Windows XP, especially when Windows NT already provided many and many ports. Porting Windows NT on other platforms is a not a hard job for Microsoft, but the problem lies on the extensibilities of Windows NT on different modes. Windows 9x could seat themselves on different modes easily, but Windows NT lack of that flexibilities. Like traditional UNIX, Windows NT is more or less like a dictator, it does not allow the ruled world with more than one system. The product of project Yamhill might possibly be like expansion of IA-32 or IA-32e, not additional mode. When it is enabled, the processor turns into the 64-bit version of IA-32, registers turns into 64-bit, instruction pointer into 64-bit and so forth. When disabled, it come back to the traditional IA-32. This thing does not require Microsoft to port the Windows XP to a third 64-bit version, but extend the current 32-bit Windows XP to support 64-bit applications. Like what I said above, Windows NT is like a dictator, it would never allow such thing happen. That might be the very reason, Project Yamhill eventually aborted. I believe it does really exist on the first generation of Prescott processor, for its large transistor numbers without considering meaningless backdoors.


Windows NT never supports more than mode, but containers, many containers provided to support those things in an emulated or almost emulated form, such as NTVDM provided for emulating the DOS applications, WoW for 16-bit Windows applications, and WoW64 for 32-bit applications.  




Mac OS X Leopard, Snow Leopard and Lion provide a kind of very special 32-bit kernel, enabling 64-bit applications to be supported incredibly! With help of virtual machines and/or cracks, I successfully run those O/S on the Celeron E3200 processor, a very common and budget processor. In other words, the processors soldered onto Macintosh computers are nothing special. And one more thing could also be inferred that the final product of Intel 64 is more or less an AMD64 clone, rather than another architecture. So Apple ever did a very crazy thing, and this so-called 32-bit is essentially a 64-bit code only left part of it realised under the compatibility mode. When a Macintosh computer equipped with only 32-bit EFI firmware, the 32-bit version of boot.efi is loaded. But it could check processor whether 64-bit enabled, if so, it load the second version of 32-bit kernel, which further trap the processor upwards to the IA-32e mode (Long Mode), rather than just stay under the protected mode. So that is only a trick, not something like found for most UNIX systems, such as AIX 4.x, 32-bit kernel support 64-bit applications. Those OSes just bind two different things (IA-32 and AMD64) intentionally and artificially.