diff options
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c index b7636207..20a6df56 100644 --- a/src/core.c +++ b/src/core.c @@ -74,6 +74,7 @@ uintptr_t fmod_smc_end = 0; uint32_t default_gs = 0x53; uint32_t default_fs = 0; int box64_isglibc234 = 0; +int box64_unittest_mode = 0; #ifdef DYNAREC cpu_ext_t cpuext = {0}; @@ -328,6 +329,7 @@ void PrintHelp() { PrintfFtrace(0, " '-v'|'--version' to print box64 version and quit\n"); PrintfFtrace(0, " '-h'|'--help' to print this and quit\n"); PrintfFtrace(0, " '-k'|'--kill-all' to kill all box64 instances\n"); + PrintfFtrace(0, " '-t'|'--test' to run a unit test\n"); PrintfFtrace(0, " '--dynacache-list' to list of DynaCache file and their validity\n"); PrintfFtrace(0, " '--dynacache-clean' to remove invalide DynaCache files\n"); } @@ -428,7 +430,7 @@ static void addLibPaths(box64context_t* context) AppendList(&context->box64_path, getenv("PATH"), 1); // in case some of the path are for x86 world } -void setupZydis(box64context_t* context) +static void setupZydis(box64context_t* context) { #ifdef HAVE_TRACE if ((BOX64ENV(trace_init) && strcmp(BOX64ENV(trace_init), "0")) || (BOX64ENV(trace) && strcmp(BOX64ENV(trace), "0"))) { @@ -728,12 +730,16 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf if(argc>1 && !strcmp(argv[1], "/usr/bin/gdb") && BOX64ENV(trace_file)) exit(0); // uname -m is redirected to box64 -m - if(argc==2 && (!strcmp(argv[1], "-m") || !strcmp(argv[1], "-p") || !strcmp(argv[1], "-i"))) - { + if (argc == 2 && (!strcmp(argv[1], "-m") || !strcmp(argv[1], "-p") || !strcmp(argv[1], "-i"))) { printf("x86_64\n"); exit(0); } + if (argc >= 3 && (!strcmp(argv[1], "--test") || !strcmp(argv[1], "-t"))) { + box64_unittest_mode = 1; + exit(unittest(argc, argv)); + } + ftrace = stdout; // grab pagesize |