What does it take to run 64-bit userland software on a 32-bit kernel?











up vote
5
down vote

favorite
1












On Linux and Windows, I'm used to the situation that I require a 64-bit kernel to have a system with multiarch/WoW where I can run 32-bit and 64-bit software side-by-side.



And then, years ago it blew my mind when someone showed me that MacOS 10.6 Snow Leopard could run 64-bit applications with the kernel in 32-bit mode. This may be largely forgotten now because it was a one-time technology transition. With the hardware ahead of the curve in the mobile space, as far as I know this was never needed in the move to 64-bit for iOS and Android.



My question: What would it take to get the same capability in a 32-bit Linux kernel (i386 or armhf)?



I understand that this probably isn't trivial. If it was, Microsoft could have put the feature into Windows XP 32-bit. What are the general requirements though? Has there ever been a proposed patch or proof-of-concept?



In the embedded world I think this would be especially helpful, as 64-bit support can lag behind for a long time in device drivers.










share|improve this question









New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Are you sure Snow Leopard could run 64-bit apps with a 32-bit kernel? IIRC the kernel was also updated on capable hardware to 64-bit.
    – muru
    14 hours ago






  • 5




    Never mind, you were right: superuser.com/a/340591/334516
    – muru
    14 hours ago















up vote
5
down vote

favorite
1












On Linux and Windows, I'm used to the situation that I require a 64-bit kernel to have a system with multiarch/WoW where I can run 32-bit and 64-bit software side-by-side.



And then, years ago it blew my mind when someone showed me that MacOS 10.6 Snow Leopard could run 64-bit applications with the kernel in 32-bit mode. This may be largely forgotten now because it was a one-time technology transition. With the hardware ahead of the curve in the mobile space, as far as I know this was never needed in the move to 64-bit for iOS and Android.



My question: What would it take to get the same capability in a 32-bit Linux kernel (i386 or armhf)?



I understand that this probably isn't trivial. If it was, Microsoft could have put the feature into Windows XP 32-bit. What are the general requirements though? Has there ever been a proposed patch or proof-of-concept?



In the embedded world I think this would be especially helpful, as 64-bit support can lag behind for a long time in device drivers.










share|improve this question









New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Are you sure Snow Leopard could run 64-bit apps with a 32-bit kernel? IIRC the kernel was also updated on capable hardware to 64-bit.
    – muru
    14 hours ago






  • 5




    Never mind, you were right: superuser.com/a/340591/334516
    – muru
    14 hours ago













up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





On Linux and Windows, I'm used to the situation that I require a 64-bit kernel to have a system with multiarch/WoW where I can run 32-bit and 64-bit software side-by-side.



And then, years ago it blew my mind when someone showed me that MacOS 10.6 Snow Leopard could run 64-bit applications with the kernel in 32-bit mode. This may be largely forgotten now because it was a one-time technology transition. With the hardware ahead of the curve in the mobile space, as far as I know this was never needed in the move to 64-bit for iOS and Android.



My question: What would it take to get the same capability in a 32-bit Linux kernel (i386 or armhf)?



I understand that this probably isn't trivial. If it was, Microsoft could have put the feature into Windows XP 32-bit. What are the general requirements though? Has there ever been a proposed patch or proof-of-concept?



In the embedded world I think this would be especially helpful, as 64-bit support can lag behind for a long time in device drivers.










share|improve this question









New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











On Linux and Windows, I'm used to the situation that I require a 64-bit kernel to have a system with multiarch/WoW where I can run 32-bit and 64-bit software side-by-side.



And then, years ago it blew my mind when someone showed me that MacOS 10.6 Snow Leopard could run 64-bit applications with the kernel in 32-bit mode. This may be largely forgotten now because it was a one-time technology transition. With the hardware ahead of the curve in the mobile space, as far as I know this was never needed in the move to 64-bit for iOS and Android.



My question: What would it take to get the same capability in a 32-bit Linux kernel (i386 or armhf)?



I understand that this probably isn't trivial. If it was, Microsoft could have put the feature into Windows XP 32-bit. What are the general requirements though? Has there ever been a proposed patch or proof-of-concept?



In the embedded world I think this would be especially helpful, as 64-bit support can lag behind for a long time in device drivers.







kernel 64bit 32bit multiarch






share|improve this question









New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago





















New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 14 hours ago









jdonald

1294




1294




New contributor




jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






jdonald is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Are you sure Snow Leopard could run 64-bit apps with a 32-bit kernel? IIRC the kernel was also updated on capable hardware to 64-bit.
    – muru
    14 hours ago






  • 5




    Never mind, you were right: superuser.com/a/340591/334516
    – muru
    14 hours ago


















  • Are you sure Snow Leopard could run 64-bit apps with a 32-bit kernel? IIRC the kernel was also updated on capable hardware to 64-bit.
    – muru
    14 hours ago






  • 5




    Never mind, you were right: superuser.com/a/340591/334516
    – muru
    14 hours ago
















Are you sure Snow Leopard could run 64-bit apps with a 32-bit kernel? IIRC the kernel was also updated on capable hardware to 64-bit.
– muru
14 hours ago




Are you sure Snow Leopard could run 64-bit apps with a 32-bit kernel? IIRC the kernel was also updated on capable hardware to 64-bit.
– muru
14 hours ago




5




5




Never mind, you were right: superuser.com/a/340591/334516
– muru
14 hours ago




Never mind, you were right: superuser.com/a/340591/334516
– muru
14 hours ago










2 Answers
2






active

oldest

votes

















up vote
10
down vote













Running 64-bit applications requires some support from the kernel: the kernel needs to at least set up page tables, interrupt tables etc. as necessary to support running 64-bit code on the CPU, and it needs to save the full 64-bit context when switching between applications (and from applications to the kernel and back). Thus a purely 32-bit kernel can’t support 64-bit userspace.



However a kernel can run 32-bit code in kernel space, while supporting 64-bit code in user space. That involves handling similar to the support required to run 32-bit applications with a 64-bit kernel: basically, the kernel has to support the 64-bit interfaces the applications expect. For example, it has to provide some mechanism for 64-bit code to call into the kernel, and preserve the meaning of the parameters (in both directions).



The question then is whether it’s worth it. On the Mac, and some other systems, a case can be made since supporting 32-bit kernel code means drivers don’t all have to make the switch simultaneously. On Linux the development model is different: anything in the kernel is migrated as necessary when large changes are made, and anything outside the kernel isn’t really supported by the kernel developers. Supporting 32-bit userland with a 64-bit kernel is certainly useful and worth the effort (at least, it was when x86-64 support was added), I’m not sure there’s a case to be made for 64-bit on 32-bit...






share|improve this answer






























    up vote
    3
    down vote













    Snow leopard was able to run 64 bits binaries in an Intel 64 bit CPU.



    It was also able to boot with a 64 bit kernel when your efi was already 64 bits (my production batch of the Macbook "transition-model" pro was already such a machine).



    There was no emulation involved, you just paid a smaller performance cost when booting in 32 bits mode afair.



    In pure 32-bit CPUs, you won't be able to do that, as they have no idea how to interpret 64 bit code. Unless you are emulating with software, which would be to slow for those kind of traditionally underpowered embedded class of machines.






    share|improve this answer























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      jdonald is a new contributor. Be nice, and check out our Code of Conduct.










       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481382%2fwhat-does-it-take-to-run-64-bit-userland-software-on-a-32-bit-kernel%23new-answer', 'question_page');
      }
      );

      Post as a guest
































      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      10
      down vote













      Running 64-bit applications requires some support from the kernel: the kernel needs to at least set up page tables, interrupt tables etc. as necessary to support running 64-bit code on the CPU, and it needs to save the full 64-bit context when switching between applications (and from applications to the kernel and back). Thus a purely 32-bit kernel can’t support 64-bit userspace.



      However a kernel can run 32-bit code in kernel space, while supporting 64-bit code in user space. That involves handling similar to the support required to run 32-bit applications with a 64-bit kernel: basically, the kernel has to support the 64-bit interfaces the applications expect. For example, it has to provide some mechanism for 64-bit code to call into the kernel, and preserve the meaning of the parameters (in both directions).



      The question then is whether it’s worth it. On the Mac, and some other systems, a case can be made since supporting 32-bit kernel code means drivers don’t all have to make the switch simultaneously. On Linux the development model is different: anything in the kernel is migrated as necessary when large changes are made, and anything outside the kernel isn’t really supported by the kernel developers. Supporting 32-bit userland with a 64-bit kernel is certainly useful and worth the effort (at least, it was when x86-64 support was added), I’m not sure there’s a case to be made for 64-bit on 32-bit...






      share|improve this answer



























        up vote
        10
        down vote













        Running 64-bit applications requires some support from the kernel: the kernel needs to at least set up page tables, interrupt tables etc. as necessary to support running 64-bit code on the CPU, and it needs to save the full 64-bit context when switching between applications (and from applications to the kernel and back). Thus a purely 32-bit kernel can’t support 64-bit userspace.



        However a kernel can run 32-bit code in kernel space, while supporting 64-bit code in user space. That involves handling similar to the support required to run 32-bit applications with a 64-bit kernel: basically, the kernel has to support the 64-bit interfaces the applications expect. For example, it has to provide some mechanism for 64-bit code to call into the kernel, and preserve the meaning of the parameters (in both directions).



        The question then is whether it’s worth it. On the Mac, and some other systems, a case can be made since supporting 32-bit kernel code means drivers don’t all have to make the switch simultaneously. On Linux the development model is different: anything in the kernel is migrated as necessary when large changes are made, and anything outside the kernel isn’t really supported by the kernel developers. Supporting 32-bit userland with a 64-bit kernel is certainly useful and worth the effort (at least, it was when x86-64 support was added), I’m not sure there’s a case to be made for 64-bit on 32-bit...






        share|improve this answer

























          up vote
          10
          down vote










          up vote
          10
          down vote









          Running 64-bit applications requires some support from the kernel: the kernel needs to at least set up page tables, interrupt tables etc. as necessary to support running 64-bit code on the CPU, and it needs to save the full 64-bit context when switching between applications (and from applications to the kernel and back). Thus a purely 32-bit kernel can’t support 64-bit userspace.



          However a kernel can run 32-bit code in kernel space, while supporting 64-bit code in user space. That involves handling similar to the support required to run 32-bit applications with a 64-bit kernel: basically, the kernel has to support the 64-bit interfaces the applications expect. For example, it has to provide some mechanism for 64-bit code to call into the kernel, and preserve the meaning of the parameters (in both directions).



          The question then is whether it’s worth it. On the Mac, and some other systems, a case can be made since supporting 32-bit kernel code means drivers don’t all have to make the switch simultaneously. On Linux the development model is different: anything in the kernel is migrated as necessary when large changes are made, and anything outside the kernel isn’t really supported by the kernel developers. Supporting 32-bit userland with a 64-bit kernel is certainly useful and worth the effort (at least, it was when x86-64 support was added), I’m not sure there’s a case to be made for 64-bit on 32-bit...






          share|improve this answer














          Running 64-bit applications requires some support from the kernel: the kernel needs to at least set up page tables, interrupt tables etc. as necessary to support running 64-bit code on the CPU, and it needs to save the full 64-bit context when switching between applications (and from applications to the kernel and back). Thus a purely 32-bit kernel can’t support 64-bit userspace.



          However a kernel can run 32-bit code in kernel space, while supporting 64-bit code in user space. That involves handling similar to the support required to run 32-bit applications with a 64-bit kernel: basically, the kernel has to support the 64-bit interfaces the applications expect. For example, it has to provide some mechanism for 64-bit code to call into the kernel, and preserve the meaning of the parameters (in both directions).



          The question then is whether it’s worth it. On the Mac, and some other systems, a case can be made since supporting 32-bit kernel code means drivers don’t all have to make the switch simultaneously. On Linux the development model is different: anything in the kernel is migrated as necessary when large changes are made, and anything outside the kernel isn’t really supported by the kernel developers. Supporting 32-bit userland with a 64-bit kernel is certainly useful and worth the effort (at least, it was when x86-64 support was added), I’m not sure there’s a case to be made for 64-bit on 32-bit...







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 3 hours ago

























          answered 12 hours ago









          Stephen Kitt

          156k23342414




          156k23342414
























              up vote
              3
              down vote













              Snow leopard was able to run 64 bits binaries in an Intel 64 bit CPU.



              It was also able to boot with a 64 bit kernel when your efi was already 64 bits (my production batch of the Macbook "transition-model" pro was already such a machine).



              There was no emulation involved, you just paid a smaller performance cost when booting in 32 bits mode afair.



              In pure 32-bit CPUs, you won't be able to do that, as they have no idea how to interpret 64 bit code. Unless you are emulating with software, which would be to slow for those kind of traditionally underpowered embedded class of machines.






              share|improve this answer



























                up vote
                3
                down vote













                Snow leopard was able to run 64 bits binaries in an Intel 64 bit CPU.



                It was also able to boot with a 64 bit kernel when your efi was already 64 bits (my production batch of the Macbook "transition-model" pro was already such a machine).



                There was no emulation involved, you just paid a smaller performance cost when booting in 32 bits mode afair.



                In pure 32-bit CPUs, you won't be able to do that, as they have no idea how to interpret 64 bit code. Unless you are emulating with software, which would be to slow for those kind of traditionally underpowered embedded class of machines.






                share|improve this answer

























                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  Snow leopard was able to run 64 bits binaries in an Intel 64 bit CPU.



                  It was also able to boot with a 64 bit kernel when your efi was already 64 bits (my production batch of the Macbook "transition-model" pro was already such a machine).



                  There was no emulation involved, you just paid a smaller performance cost when booting in 32 bits mode afair.



                  In pure 32-bit CPUs, you won't be able to do that, as they have no idea how to interpret 64 bit code. Unless you are emulating with software, which would be to slow for those kind of traditionally underpowered embedded class of machines.






                  share|improve this answer














                  Snow leopard was able to run 64 bits binaries in an Intel 64 bit CPU.



                  It was also able to boot with a 64 bit kernel when your efi was already 64 bits (my production batch of the Macbook "transition-model" pro was already such a machine).



                  There was no emulation involved, you just paid a smaller performance cost when booting in 32 bits mode afair.



                  In pure 32-bit CPUs, you won't be able to do that, as they have no idea how to interpret 64 bit code. Unless you are emulating with software, which would be to slow for those kind of traditionally underpowered embedded class of machines.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 13 hours ago

























                  answered 13 hours ago









                  Rui F Ribeiro

                  38.1k1475123




                  38.1k1475123






















                      jdonald is a new contributor. Be nice, and check out our Code of Conduct.










                       

                      draft saved


                      draft discarded


















                      jdonald is a new contributor. Be nice, and check out our Code of Conduct.













                      jdonald is a new contributor. Be nice, and check out our Code of Conduct.












                      jdonald is a new contributor. Be nice, and check out our Code of Conduct.















                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481382%2fwhat-does-it-take-to-run-64-bit-userland-software-on-a-32-bit-kernel%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest




















































































                      Popular posts from this blog

                      Aardman Animations

                      Are they similar matrix

                      “minimization” problem in Euclidean space related to orthonormal basis