[HN Gopher] Box64 lets you run x86_64 programs on non-x86_64 sys...
       ___________________________________________________________________
        
       Box64 lets you run x86_64 programs on non-x86_64 systems
        
       Author : marcodiego
       Score  : 167 points
       Date   : 2021-11-20 02:45 UTC (20 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | spijdar wrote:
       | Since it's not immediately clear looking at the repo, and porting
       | it has been a side project of mine, I'll go ahead and add that
       | PowerPC is one of the other non-ARM platforms supported. Both on
       | box64 and box86, although ppcle is still a mess of a target
       | triplet.
       | 
       | I'm also aware that it should work on LoongArch64!
       | 
       | Box64/86 is frankly not very pretty or elegant, but it's very
       | surprising how much can be coerced to run through it, and by
       | wrapping native libraries it can achieve staggering performance
       | compared to QEMU or other full system emulators.
       | 
       | As in, you can actually use this to play games and run
       | applications at usable speeds. Playing x86/x64 games on my POWER9
       | system has been gratifying ;-)
        
         | messe wrote:
         | > I'll go ahead and add that PowerPC is one of the other non-
         | ARM platforms supported. Both on box64 and box86, although
         | ppcle is still a mess of a target triplet.
         | 
         | Does that include big endian support?
        
       | Sophira wrote:
       | Genuine question: Is there any naming issue with this project
       | considering that there exists an emulator called Bochs which
       | could be used to run x86_64 programs on non-x86_64 systems
       | (albeit via the route of actually emulating a full machine)?
        
         | gattilorenz wrote:
         | There's also 86box, which is somewhat similar to bochs, in that
         | it emulates 8086-Pentium II era hardware. But then again,
         | there's plenty of bad naming issues with software... This one
         | even has a different spelling, it's commendable.
        
       | xnx wrote:
       | > Box64 lets you run x86_64 Linux programs (such as games) on
       | non-x86_64 Linux systems, like ARM (host system needs to be 64bit
       | little-endian).
       | 
       | Does this include the M1 Max?
        
         | my123 wrote:
         | When in a Linux VM yes. Know however that box64 doesn't have
         | exactly ideal perf characteristics, quite the reverse.
         | Especially on that (recent) hardware.
        
       | ekianjo wrote:
       | Relevant, we interviewed PtitSeb not too long ago on his work on
       | Box86 and Box64: https://boilingsteam.com/box64-witness-the-
       | birth-of-the-arm-...
        
       | rnd0 wrote:
       | I apologize if this is too critical; but this seems to have a lot
       | of caveats and is not only not portable -but almost anti-
       | portable.
       | 
       | What's the advantage of this over something that can run on BSD
       | like Qemu? (I was going to ask about BSD hypervisors like vmm,
       | bhyve and then realized they're i386/amd64 specific).
        
         | zamadatix wrote:
         | QEMU is a full system emulator, Box64 emulates the app but
         | tries to use native versions of libraries. This is the approach
         | Microsoft and Apple use for running x86-64 code on ARM64 as it
         | is more performant than full system emulation and it allows
         | apps to run in a more integrated way.
        
           | lukeh wrote:
           | As I understand it, Rosetta 2 uses translated versions of the
           | libraries too, but a single native kernel. I'm not sure what
           | Windows does.
        
             | dundarious wrote:
             | I think you're mixing up WSL2 and x86 (is x64 out yet?)
             | emulation for Surface (running on aarch64). WSL2 runs a
             | full Linux kernel on top of the Windows kernel, to be able
             | to run Linux binaries with high compatibility (and good
             | performance). x86 emulation translates a Windows x86 binary
             | into a Windows aarch64 binary, so there is only the Windows
             | kernel. Rosetta 2 works like this too. And so does
             | box86/64.
             | 
             | So x86 emulation, Rosetta 2, and box86/64 all use
             | translated binaries and a single kernel.
             | 
             | At least, that is my understanding.
             | 
             | I defer to you on whether Rosetta 2 is translating
             | _libraries_ as well (as opposed to box86 /64's approach
             | which is to use some native libraries), I don't know.
        
             | twoodfin wrote:
             | Yeah I was surprised when Apple didn't go that way for
             | Rosetta 2, especially after just a year or so prior forcing
             | all Mac apps onto a single 64-bit runtime.
        
           | oshiar53-0 wrote:
           | QEMU _softmmu_ is a full system emulator. There 's another
           | mode of QEMU build (qemu-user) that emulates userspace
           | applications (just like Rosetta and WoW) and even lets you
           | link to native libraries.
        
             | oshiar53-0 wrote:
             | Edit: I confused QEMU usermode with something else. QEMU
             | seems to only do syscall/ioctl translation at the moment.
             | My sincere apologies (I can't delete the comment).
             | 
             | Maybe library call stubbing (not x64 exclusive) could be my
             | next project.
        
             | spijdar wrote:
             | > and even lets you link to native libraries.
             | 
             | I'd be interested to learn more about this. My experience
             | with qemu's usermode emulation is it only wraps syscalls
             | and some ioctls. So you need a complete userland in the
             | target arch.
             | 
             | In particular, it doesn't really wrap any DRM interfaces
             | very well/thoroughly (as of when I tried), so you couldn't
             | get 3D hardware acceleration working.
             | 
             | box64 bypasses this problem by just wrapping the native
             | mesa libraries, avoiding opening that can of ioctl worms.
             | 
             | (To my knowledge WoW is the same in that it doesn't emulate
             | the entire userland stack up to the syscall layer but can
             | wrap calls to DLLs to native ones, not unlime the Hangover
             | project does for x86 wine on Aarch64/ppc64le Linux)
        
               | zozbot234 wrote:
               | > My experience with qemu's usermode emulation is it only
               | wraps syscalls and some ioctls. So you need a complete
               | userland in the target arch.
               | 
               | Yes, but that's required because the native userland
               | would have a totally different ABI, so it's just not
               | going to work with the target code even in emulated form.
               | The best you can do is have the "target" userland marshal
               | calls to the native userland, translating across native
               | and target ABI. But even that is likely unfeasible in the
               | general case.
        
               | comex wrote:
               | > The best you can do is have the "target" userland
               | marshal calls to the native userland, translating across
               | native and target ABI.
               | 
               | Which is what Box64 does.
        
       | 58028641 wrote:
       | FEX-Emu is a similar program. Not sure which one is better.
       | https://github.com/FEX-Emu/FEX
        
       | ahP7Deew wrote:
       | Does anyone have handy perf numbers for both box64 and qemu?
       | Everyone says "it's slow" but I'd love to see some benchmark
       | numbers for relative performance.
        
       | aasasd wrote:
       | There's a vaguely similar-ish project Hangover, which integrates
       | Qemu and Wine, to run Windows apps on ARM and whatnot:
       | https://github.com/AndreRH/hangover
       | 
       | As I understand it, Qemu in this arrangement only translates the
       | code, without emulating hardware.
       | 
       | Alas, the project does not target Android anymore (at the
       | moment)--it was one hope for running 90s games on a phone or
       | tablet. Though the current status seems quite raw anyway, so
       | things may change many times yet.
        
       ___________________________________________________________________
       (page generated 2021-11-20 23:02 UTC)