From 508a1539737b5ba86516c73e34bf167eb37859ad Mon Sep 17 00:00:00 2001 From: josch Date: Wed, 31 Jan 2024 17:29:34 +0000 Subject: When BOX64_VERSION is set, just print the version and exit (#1238) When set, box64 will only print its version and then exit. This option is analogous to QEMU_VERSION used by binfmt_misc emulation of qemu-user. Its purpose is the same: provide a way to soft-disable binfmt_misc emulation as well as for identifying box64 as the registered binfmt_misc emulator. This commit enables adding support for box64 to the arch-test utility. With this change, arch-test is able to soft-disable box64 as the x86_64 emulator in the same way as it does this for qemu and wine already. Without this change, arch-test will report an architecture as natively executable by the processor, disregarding that it actually gets emulated by box64. Furthermore, this commit enables identifying box64 as the currently registered emulator for x86_64. This way, applications that know that their emulation requirements cannot work with box64 can add a check to find out that it is box64 doing the emulation and are able to print a helpful error message. Closes: #1237 --- src/main.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/main.c b/src/main.c index 62919466..316ec2f8 100644 --- a/src/main.c +++ b/src/main.c @@ -1468,6 +1468,11 @@ extern char** environ; int main(int argc, const char **argv, char **env) { init_malloc_hook(); init_auxval(argc, argv, environ?environ:env); + // analogue to QEMU_VERSION in qemu-user-mode emulation + if(getenv("BOX64_VERSION")) { + PrintBox64Version(); + exit(0); + } // trying to open and load 1st arg if(argc==1) { /*PrintBox64Version(); -- cgit 1.4.1