32-bit kernel in Leopard?

Discussion in 'Mac Programming' started by planetbeing, Nov 7, 2007.

  1. planetbeing macrumors member

    Oct 11, 2007
    I've already done some research, but Google has been giving me diminishing returns, so I thought it might be more efficient just to ask.

    As you know, Apple markets Leopard as a 64-bit operating system. It also advertises full compatibility with existing 32-bit drivers and applications "with no emulation". Application compatibility seems to be done by simply having two versions of every library (well, more like four, because of PowerPC).

    So what about driver compatibility? Well, at little research has indicated that the kernel itself is still 32-bit, in order to maintain compatibility with 32-bit drivers. That's all good and well. But...

    How the heck would it run 64-bit drivers?!

    Could someone explain to me whether 64-bit drivers run, and how this is accomplished?
  2. Muncher macrumors 65816


    Apr 19, 2007
    As far as I know (and I know very little :D), the discs contain both a 64-bit and a 32-bit version for x86 processors, as well as a 64 and 32-bit version for ppc processors. Now, I personally can't see how they fit it all on there,and my guess is that there's some common non-crucial 32-bit code for the ppc and x86. That would be (if anything) apps like safari or mail, or other things like that.

    But I really don't know. I just saw a question with no answer, thought about it, and took a well aimed stab :D.
  3. larkost macrumors 6502a

    Oct 13, 2007
    You don't need 64bit drivers, and there are none on the Mac platform. Windows only needs them because Microsoft messed up the transition so badly and haas ot have two completely separate environment. Apple has a much cleaner implementation that nicely allows 32bit and 64bit to run together (more or less).
  4. planetbeing thread starter macrumors member

    Oct 11, 2007
    @larkost: I don't think your description of the situation is accurate.

    Microsoft's implementation is a lightweight translation layer called WOW64 that sits between 64-bit libraries and 32-bit applications. Apple's solution is to ship both 32-bit and 64-bit libraries. If anything, OS X is the one that has two completely separate environments.

    Microsoft's solution, however, is necessarily more complex because the problem is complicated by the existence of the registry, which OS X doesn't have. The translation layer has to handle that as well.

    However, it seems to be done well, and there are no problems that are innately related to running in a 64-bit environment.

    I have much less information on Apple, however, and that's what I'm trying to remedy. Do you have a source on the assertion that there are no and can be no 64-bit drivers for Leopard?

    @Muncher: Thanks for replying! Code usually doesn't take that much room, it's the resources that do most of the damage, as a look through my iTunes directory will attest.

    However, I read elsewhere that Apple didn't actually bundle any 64-bit applications with Leopard (only Chess as a demo application) because most applications would just take up more space in memory (64-bit code is bigger) without any perceptible performance benefit.
  5. gnasher729 macrumors P6


    Nov 25, 2005
    It doesn't. And it never will until someone comes up with a reason why having a 64-bit driver would be an advantage to any user, and on top of that an advantage that is worth the extra programming, debugging and maintenance effort for the driver developer.
  6. Persifleur macrumors member

    Jun 1, 2005
    London, UK

    How does it do it? I don't know enough about kernel design to speculate.
  7. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    Actually going to 64-bit on Intel hardware would be an advantage because of the architectural changes inherent in such a change e.g. more general purpose registers available (matching what PPC has had since forever) and register-based parameter passing instead of stack-based passing and PC-relative addressing (as with PPC et al).

    For PowerPC the difference between 32-bit and 64-bit is semantic, there really is no difference at the lower levels. For intel CPUs OS X intelligently loads an appropriate binary based on environment and the software that it is running, A single app can potentially have four different executables inside it: 32-bit PPC, 64-bit PPC, 32-bit intel, and 64-bit intel.

    There is no hard requirement for a 64-bit app/framework/driver to run on a 64-bit processor under OS X in 64-bit mode. This aint Windoze, folks.
  8. iSee macrumors 68040


    Oct 25, 2004
    There aren't really 64-bit drivers on Mac OS X.
    There are a few things you have to do to play nice with or even take advantage of a 64-bit memory space.



    By the way, even reading the word WOW64 makes me want to barf. Ugh. Admitedly, I had to deal with it in the worst possible situation (dealing with installation and configuration of 64-bit and 32-bit drivers and related software from both 32-bit and 64-bit code--don't ask why--one of our suppliers were incredible idiots). WOW64 is terrible, horrible, ugly, and disgusting.
  9. Krevnik macrumors 68040


    Sep 8, 2003
    The kernel is 32-bit.

    You can write your driver to have a 64-bit image in the binary, but it won't ever get loaded by Leopard, since the kernel is a 32-bit process and will link against the 32-bit images of the drivers.

    That said, if you write drivers, I recommend letting it built 64-bit as well, as it will save you time in the long-run when a 64-bit kernel is introduced. You will at least have a compiling version of the driver which will have good odds of just working.

Share This Page