AndreRH / hangover

Hangover runs simple Win32 applications on arm64 Linux
GNU Lesser General Public License v2.1
1.24k stars 91 forks source link

Can hangover work in 32-bit prefix? #147

Closed knyipab closed 1 month ago

knyipab commented 2 months ago

I am currently trying to use MS Office, which only installs in a 32-bit prefix, not on 64-bit and not wow64.

The installation into a 32-bit prefix can be done by PC. However, could hangover support a 32-bit prefix? I know box64 won't execute 32-bit instructions at all, but how about FEX and it should execute 32-bit on an ARM64 Linux.

AndreRH commented 1 month ago

First, we use Box64 only for 32-bit instructions currently, cause it can execute them. But running Hangover in a 32-bit prefix won't work.

knyipab commented 1 month ago

Sorry that I got confused. ptitSeb/box64 mentions that So understand that box64 will only run 64-bit linux binaries. For 32-bit binaries, you need box86 (with all the multiarch or proot trickery it implies on a 64-bit OS).

Or a modified box64 is used in hangover? Or the box64 README is not outdated?

I thought the 32-bit to 64-bit instruction translation is done by WOW64 of Wine (which I am not sure). Sorry for my ignorance.

stefand commented 1 month ago

WoW64 doesn't translate instructions itself. It merely translates ntdll syscalls from 32 bit ntdll to 64 bit ntdll (and win32k etc). For handling the actual instructions it either uses an emulator (x86 on arm64) or CPU features (x86 on x86_64). It calls the emulator and handles exits out of the emulator, but doesn't emulate instructions itself.

I am a bit out of the loop with recent developments re x86 on ARM in Wine. The problem I guess exists with 32 bit x86 on 32 bit ARM is the address space handling and that there is no 32 bit equivalent of arm64ec. In theory both would be fixable, but the 4 GB 32 bit address space is a lot more limited than the 64 bit one, so address conflicts are more likely. I think though it would be a mostly useless endeavor - modern arm machines are 64 bit, and even that isn't working all too well yet, so supporting dying 32 bit host processes is a waste of time. To my knowledge arm32 windows also doesn't support any kind of x86 emulation.

That said, I doubt you'll have luck with something as complex as Microsoft office anytime soon. The fact that it doesn't work in a 64 bit prefix on regular Intel-CPU Wine doesn't bode well for supporting it on a foreign architecture at this point.

AndreRH commented 1 month ago

Sorry that I got confused. ptitSeb/box64 mentions that So understand that box64 will only run 64-bit linux binaries. For 32-bit binaries, you need box86 (with all the multiarch or proot trickery it implies on a 64-bit OS).

That's mostly about the loader, which only will handle 64-bit linux binaries. But for Hangover that loader isn't used, as Wine will simply load PE files with it's own loader.