Sunday, September 13, 2009

Mac OS X's 64-bit modes

There is actually three modes that the Snow Leopard kernel can run, some of which are often confused:
  • The first Intel Macs shipped with 32-bit only processors that do not support long mode. Thus the first version of Intel Mac OS X 10.4 ran in legacy mode with PAE enabled. All later versions, including Snow Leopard, can run in this mode. In this mode only 32-bit applications can be run, the kernel is fully 32-bit (thus 32-bit kexts are needed), V86 mode is available, but since PAE was enabled, full physical address width (at least 36-bit) is available and NX is enabled.
  • Later Intel Macs shipped with 64-bit processors that support long mode. These Macs shipped with the second version of Intel Mac OS X 10.4. This version can run in long mode, but most of the kernel ran in compatiblity mode, thus old 32-bit kexts still can run, but not all the kernel can run in compatiblity mode. For example, interrupt, trap, and call gates have to point to code that runs in 64-bit mode. 64-bit applications can however run in full 64-bit mode, and V86 mode is NOT available. And of course full physical address width is available and NX is enabled.
  • Snow Leopard, which introduced the 64-bit kernel, added a third so called 64-bit kernel mode that is the same as the previous mode, except that the kernel run in in full 64-bit mode and thus new 64-bit kexts are needed. 64-bit EFI is required too for this mode to run.