How come a 32 bit kernel can run a 64 bit binary?

前端 未结 6 1961
太阳男子
太阳男子 2021-02-02 10:09

On my OS X box, the kernel is a 32 bit binary and yet it can run a 64 bit binary. How does this work?

cristi:~ diciu$ file ./a.out
./a.out: Mach-O 64-bit executable x         


        
6条回答
  •  花落未央
    2021-02-02 10:14

    It's not the kernel that runs the binary. It's the processor.

    The binary does call library functions and those need to be 64bit. And if they need to make a system call, it's their responsibility to cope with the fact that they themselves are 64bit, but the kernel is only 32.

    But that's not something you would have to worry about.

提交回复
热议问题