Box64 lets you run x86_64 programs on non-x86_64 systems
github.com
github.com
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 ;-)
Does that include big endian support?
However, most 32 bit PowerPC cores did implement a sort of LE support, by munging memory addresses on reads/writes to word aligned scalars, and letting the OS kernel fix up misaligned and non-scalar operations. This looked like LE to the user process, although it resulted in real-mode memory being BE.
The caveat is, of course, the kernel has to be running as LE, which would require firmware/hardware support (most PPC boards are designed to run BE), or for the kernel to swizzle memory to/from said firmware/hardware.
Another possibility would be to run an LE userland under a BE kernel, which Linux does support. The caveat is the kernel expects all syscalls and ioctls to be the kernel's endianness, so either you handle the swizzling in the kernel, or pass the responsibility to the userland.
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).
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)
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.
Which is what Box64 does.
Maybe library call stubbing (not x64 exclusive) could be my next project.
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.
Does this include the M1 Max?
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.