There is a 32-bit target of gcc, can't remember what it is called (x32?), that uses 32-bit instructions that work under x64.
For that to actually work, the x64 system will need to be cooperative, and map (using virtual memory) the 4 GiB to 8 GiB region onto the 0-4 GiB region so that negative indexes still "wrap". And if that "x32" executable were to be run on an ARM64 Linux system using qemu-x32 (if it existed) - and note - this is qemu user, not qemu-system-* - then the ARM64 system would also need to be cooperative (or qemu would - whose responsibility is it?) to also have that 32-bit wrapping. How was this issue solved? I have the same situation with qemu-s390x. For whatever reason, there is no qemu-s390 shipped. I have tools (the linker pdld) that will force my 32-bit executable to be ELF64, and it all works fine - under both qemu user and system running real z/Linux - so long as I don't have any negative indexes. Negative indexes aren't that common, so a lot of code runs. But negative indexes aren't non-existent, so some applications have failed, and I need to know how the problem was solved. Note that this is a general thing in computer science. I don't know a specific system, but if there was one that allowed both 16-bit and 32-bit instructions to work without mode-switching, then if a 32-bit OS has activated virtual memory it should ideally map the 64k - 128k region to 0-64k to allow 16-bit programs to be loaded in the first 64k of the virtual memory space and still use negative indexes. Perhaps ideally systems should all be like s390x (aka z/Arch) and allow 32-bit and 64-bit code to run without mode changes. Note that mode changes is a different concept from address masking (although there is some overlap). There is effectively no address masking being used for 32-bit programs running as AM64. AM64 is effectively "no masking of address bits" - the same as AM32 would be. The 32-bit executables with 32-bit general purpose registers will run regardless of what address masking is being done, e.g. AM32 like the S360/67, AM31 like S/370XA and above, and AM24 like S/370 and most of the below. Plus emulators of any of the above, or similar. Or rather - they can run, so long as you don't attempt to store data in any of the bits you are expecting to be masked. THAT was the issue all along - culture. BFN. Paul.