Added BOX86_NOSIGILL

This commit is contained in:
ptitSeb 2020-04-24 11:11:22 +02:00
parent 96c4fe7057
commit 2a8e6061a2
4 changed files with 16 additions and 1 deletions

View File

@ -58,6 +58,11 @@ To disable handling of SigSEGV (to ease debugging mainly)
* 0 : default, let x86 program set sighandler for SEGV
* 1 : disable handling of SigSEGV
#### BOX86_NOSIGILL
To disable handling of SigILL (to ease debugging mainly)
* 0 : default, let x86 program set sighandler for Illegal Instruction
* 1 : disable handling of SigILL
#### BOX86_X11COLOR16
PANDORA only: to try convert X11 color from 32 bits to 16 bits (to avoid light green on light cyan windows
* 0 : default, don't touch X11 colors

View File

@ -151,6 +151,7 @@ typedef struct box86context_s {
uintptr_t restorer[MAX_SIGNAL];
x86emu_t *emu_sig; // the emu with stack used for signal handling (must be separated from main ones)
int no_sigsegv;
int no_sigill;
} box86context_t;

View File

@ -181,7 +181,7 @@ static void CheckSignalContext(x86emu_t* emu, int sig)
const int stsize = 2*1024*1024;
void* stack = calloc(1, stsize);
my_context->emu_sig = NewX86Emu(my_context, 0, (uintptr_t)stack, stsize, 1);
SetTraceEmu(my_context->emu_sig, 0/*my_context->emu->trace_start*/, 0/*my_context->emu->trace_end*/);
SetTraceEmu(my_context->emu_sig, my_context->emu->trace_start, my_context->emu->trace_end);
}
}
@ -214,6 +214,9 @@ int EXPORT my_sigaction(x86emu_t* emu, int signum, const x86_sigaction_t *act, x
if(signum==SIGSEGV && emu->context->no_sigsegv)
return 0;
if(signum==SIGILL && emu->context->no_sigill)
return 0;
CheckSignalContext(emu, signum);
struct sigaction newact = {0};

View File

@ -390,6 +390,7 @@ void PrintHelp() {
printf(" BOX86_DLSYM_ERROR with 1 to log dlsym errors\n");
printf(" BOX86_LOAD_ADDR=0xXXXXXX try to load at 0xXXXXXX main binary (if binary is a PIE)\n");
printf(" BOX86_NOSIGSEGV=1 to disable handling of SigSEGV\n");
printf(" BOX86_NOSIGILL=1 to disable handling of SigILL\n");
#ifdef PANDORA
printf(" BOX86_X11COLOR16=1 to try convert X11 color from 32 bits to 16 bits (to avoid light green on light cyan windows\n");
#endif
@ -438,6 +439,11 @@ void LoadEnvVars(box86context_t *context)
context->no_sigsegv = 1;
printf_log(LOG_INFO, "BOX86: Disabling handling of SigSEGV\n");
}
if(getenv("BOX86_NOSIGILL")) {
if (strcmp(getenv("BOX86_NOSIGILL"), "1")==0)
context->no_sigill = 1;
printf_log(LOG_INFO, "BOX86: Disabling handling of SigILL\n");
}
// check BOX86_PATH and load it
LoadEnvPath(&context->box86_path, ".:bin", "BOX86_PATH");
if(getenv("PATH"))