diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-07-23 11:13:28 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-07-23 11:13:37 +0200 |
| commit | 49cc5eabcbcebdd6a67bfa32a82caf1723997d78 (patch) | |
| tree | 18789911b978ca0fa85a336f75cff117903c8a3f /src/emu | |
| parent | bf429a1dcfdaa960857f03a6f85e0dbf83e8b1e4 (diff) | |
| download | box64-49cc5eabcbcebdd6a67bfa32a82caf1723997d78.tar.gz box64-49cc5eabcbcebdd6a67bfa32a82caf1723997d78.zip | |
Some handling of case where signal numbers differs between native and x64 archs (not complete, missing sigset conversions)
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64int3.c | 6 | ||||
| -rw-r--r-- | src/emu/x64run.c | 35 | ||||
| -rw-r--r-- | src/emu/x64run0f.c | 28 | ||||
| -rw-r--r-- | src/emu/x64run660f.c | 8 | ||||
| -rw-r--r-- | src/emu/x64run670f.c | 4 | ||||
| -rw-r--r-- | src/emu/x64runavx0f.c | 6 | ||||
| -rw-r--r-- | src/emu/x64runavx0f38.c | 14 | ||||
| -rw-r--r-- | src/emu/x64runavx660f.c | 4 | ||||
| -rw-r--r-- | src/emu/x64runavx660f38.c | 10 | ||||
| -rw-r--r-- | src/emu/x64runavx660f3a.c | 8 | ||||
| -rw-r--r-- | src/emu/x64runf20f.c | 6 | ||||
| -rw-r--r-- | src/emu/x64syscall.c | 7 | ||||
| -rwxr-xr-x | src/emu/x86int3.c | 6 |
13 files changed, 73 insertions, 69 deletions
diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c index 1e9d2376..f79a451d 100644 --- a/src/emu/x64int3.c +++ b/src/emu/x64int3.c @@ -8,11 +8,11 @@ #include <unistd.h> #include <sys/types.h> #include <pthread.h> -#include <signal.h> #include <poll.h> #include <sys/wait.h> #include <elf.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -395,9 +395,9 @@ void x64Int3(x64emu_t* emu, uintptr_t* addr) printf_log(LOG_DEBUG, "%04d|Warning, x64int3 with no CC opcode at %p?\n", GetTID(), (void*)R_RIP); return; } - if(!BOX64ENV(ignoreint3) && my_context->signals[SIGTRAP]) { + if(!BOX64ENV(ignoreint3) && my_context->signals[X64_SIGTRAP]) { R_RIP = *addr; // update RIP - EmitSignal(emu, SIGTRAP, NULL, 3); + EmitSignal(emu, X64_SIGTRAP, NULL, 3); } else { printf_log(LOG_DEBUG, "%04d|Warning, ignoring unsupported Int 3 call @%p\n", GetTID(), (void*)R_RIP); R_RIP = *addr; diff --git a/src/emu/x64run.c b/src/emu/x64run.c index af2bc58f..a393e84c 100644 --- a/src/emu/x64run.c +++ b/src/emu/x64run.c @@ -7,6 +7,7 @@ #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -333,7 +334,7 @@ x64emurun: if(rex.is32bits) { R_AX = aas16(emu, R_AX); } else { - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); goto fini; } break; @@ -433,7 +434,7 @@ x64emurun: GETGD; int* bounds = (int*)GETEA(0); if(bounds[0]<GD->dword[0] || bounds[1]>GD->dword[0]) - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xb09d); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xb09d); } else { unimp = 1; goto fini; @@ -592,7 +593,7 @@ x64emurun: if(rex.is32bits && BOX64ENV(ignoreint3)) { } else { - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); } STEP; #endif @@ -1562,7 +1563,7 @@ x64emurun: } else if (tmp8u==0x03) { R_RIP = addr; #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGTRAP, NULL, 3); + EmitSignal(emu, X64_SIGTRAP, NULL, 3); STEP2; #endif } else { @@ -1598,7 +1599,7 @@ x64emurun: if((new_cs&3)!=3) { printf_log(LOG_NONE, "Warning, unexpected new_cs=0x%x\n", new_cs); R_RSP-=(rex.w?4:8)*2; - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); // GP if trying to change priv level + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); // GP if trying to change priv level } #endif RESET_FLAGS(emu); @@ -1878,7 +1879,7 @@ x64emurun: F8; if(rex.is32bits && BOX64ENV(ignoreint3)) {} else - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; #endif break; @@ -1918,7 +1919,7 @@ x64emurun: #ifndef TEST_INTERPRETER if(rex.is32bits && BOX64ENV(ignoreint3)) {} else - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; #endif break; @@ -1940,14 +1941,14 @@ x64emurun: case 0xF1: /* INT1 */ emu->old_ip = R_RIP; #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 128); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 128); #endif break; case 0xF4: /* HLT */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; #endif break; @@ -2093,14 +2094,14 @@ x64emurun: // this is a privilege opcode if(rex.is32bits && BOX64ENV(ignoreint3)) {} else - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; break; case 0xFB: /* STI */ // this is a privilege opcode if(rex.is32bits && BOX64ENV(ignoreint3)) {} else - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; break; case 0xFC: /* CLD */ @@ -2167,7 +2168,7 @@ x64emurun: GETET(0); if(MODREG) { printf_log(LOG_NONE, "Illegal Opcode %p: (%02X %02X %02X %02X) %02X %02X %02X %02X\n", (void*)R_RIP, PK(-6), PK(-5), PK(-4), PK(-3), opcode, nextop, PK(0), PK(1)); - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); goto fini; } else { if(rex.is32bits || !rex.w) { @@ -2216,7 +2217,7 @@ x64emurun: GETET(0); if(MODREG) { printf_log(LOG_NONE, "Illegal Opcode %p: (%02X %02X %02X %02X) %02X %02X %02X %02X\n", (void*)R_RIP, PK(-6), PK(-5), PK(-4), PK(-3), opcode, nextop, PK(0), PK(1)); - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); goto fini; } else { if(rex.is32bits || !rex.w) { @@ -2260,7 +2261,7 @@ x64emurun: break; default: printf_log(LOG_NONE, "Illegal Opcode %p: (%02X %02X %02X %02X) %02X %02X %02X %02X %02X %02X\n", (void*)R_RIP, PK(-6), PK(-5), PK(-4), PK(-3), opcode, nextop, PK(0), PK(1), PK(2), PK(3)); - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); goto fini; } break; @@ -2276,7 +2277,7 @@ x64emurun: } else { tf_next = 0; R_RIP = addr; - EmitSignal(emu, SIGTRAP, (void*)addr, 1); + EmitSignal(emu, X64_SIGTRAP, (void*)addr, 1); if(emu->quit) goto fini; } } @@ -2290,7 +2291,7 @@ fini: // check the TRACE flag before going to out, in case it's a step by step scenario if(!emu->quit && !emu->fork && ACCESS_FLAG(F_TF)) { R_RIP = addr; - EmitSignal(emu, SIGTRAP, (void*)addr, 1); + EmitSignal(emu, X64_SIGTRAP, (void*)addr, 1); if(emu->quit) goto fini; } #endif @@ -2300,7 +2301,7 @@ if(emu->segs[_CS]!=0x33 && emu->segs[_CS]!=0x23) printf_log(LOG_NONE, "Warning, if(unimp) { //emu->quit = 1; UnimpOpcode(emu, is32bits); - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); } // fork handling if(emu->fork) { diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c index 92de2706..046861da 100644 --- a/src/emu/x64run0f.c +++ b/src/emu/x64run0f.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -96,19 +96,19 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0xC8: /* MONITOR */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; case 0xC9: /* MWAIT */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; case 0xD0: if(R_RCX) { #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif } else { R_RAX = 0b111; // x87 & SSE & AVX for now @@ -185,7 +185,7 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x06: /* CLTS */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; @@ -193,13 +193,13 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x09: /* WBINVD */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; case 0x0B: /* UD2 */ #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif break; @@ -222,7 +222,7 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) break; case 0x0E: /* FEMMS */ #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif break; @@ -312,7 +312,7 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x23: /* MOV drX, REG */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; @@ -413,7 +413,7 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x30: /* WRMSR */ // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; case 0x31: /* RDTSC */ @@ -426,20 +426,20 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x32: /* RDMSR */ // priviledge instruction #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; #endif break; case 0x34: /* SYSENTER */ #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; #endif break; case 0x35: /* SYSEXIT */ #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0xbad0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0xbad0); STEP; #endif break; @@ -713,7 +713,7 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x3F: #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif break; GOCOND(0x40 diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c index 5129bc7b..c3405bc5 100644 --- a/src/emu/x64run660f.c +++ b/src/emu/x64run660f.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -720,7 +720,7 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr) GETED(0); // this is a privilege opcode... #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGSEGV, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGSEGV, (void*)R_RIP, 0); #endif break; @@ -1700,7 +1700,7 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr) nextop = F8; if(!BOX64ENV(cputype) || (nextop&0xC0)>>3) { #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif } else { //TODO: test /0 @@ -1716,7 +1716,7 @@ uintptr_t Run660F(x64emu_t *emu, rex_t rex, uintptr_t addr) nextop = F8; if(!BOX64ENV(cputype) || !(MODREG)) { #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif } else { //TODO: test/r diff --git a/src/emu/x64run670f.c b/src/emu/x64run670f.c index 870c8fac..54fe8808 100644 --- a/src/emu/x64run670f.c +++ b/src/emu/x64run670f.c @@ -4,10 +4,10 @@ #include <stdlib.h> #include <math.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -189,7 +189,7 @@ uintptr_t Run670F(x64emu_t *emu, rex_t rex, int rep, uintptr_t addr) nextop = F8; FAKEED32(0); #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif break; default: diff --git a/src/emu/x64runavx0f.c b/src/emu/x64runavx0f.c index 934bed34..9093de3c 100644 --- a/src/emu/x64runavx0f.c +++ b/src/emu/x64runavx0f.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -604,13 +604,13 @@ uintptr_t RunAVX_0F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0x77: if(!vex.l) { // VZEROUPPER if(vex.v!=0) { - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); } else { memset(emu->ymm, 0, sizeof(sse_regs_t)*((vex.rex.is32bits)?8:16)); } } else { // VZEROALL if(vex.v!=0) { - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); } else { memset(emu->xmm, 0, sizeof(sse_regs_t)*((vex.rex.is32bits)?8:16)); memset(emu->ymm, 0, sizeof(sse_regs_t)*((vex.rex.is32bits)?8:16)); diff --git a/src/emu/x64runavx0f38.c b/src/emu/x64runavx0f38.c index a96b8f6b..a17b2e75 100644 --- a/src/emu/x64runavx0f38.c +++ b/src/emu/x64runavx0f38.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -61,7 +61,7 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0xF2: /* ANDN Gd, Vd, Ed */ nextop = F8; - if(vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); ResetFlags(emu); GETGD; GETED(0); @@ -81,7 +81,7 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) nextop = F8; switch((nextop>>3)&7) { case 1: /* BLSR Vd, Ed */ - if(vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); ResetFlags(emu); GETVD; GETED(0); @@ -101,7 +101,7 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) } break; case 2: /* BLSMSK Vd, Ed */ - if(vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); ResetFlags(emu); GETVD; GETED(0); @@ -122,7 +122,7 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) } break; case 3: /* BLSI Vd, Ed */ - if(vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); ResetFlags(emu); GETVD; GETED(0); @@ -151,7 +151,7 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0xF5: /* BZHI Gd, Ed, Vd */ nextop = F8; - if(vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); GETGD; GETED(0); GETVD; @@ -179,7 +179,7 @@ uintptr_t RunAVX_0F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0xF7: /* BEXTR Gd, Ed, Vd */ nextop = F8; - if(vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); ResetFlags(emu); GETGD; GETED(0); diff --git a/src/emu/x64runavx660f.c b/src/emu/x64runavx660f.c index b08a5f6c..5570a979 100644 --- a/src/emu/x64runavx660f.c +++ b/src/emu/x64runavx660f.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -1956,7 +1956,7 @@ uintptr_t RunAVX_660F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0xF7: /* VMASKMOVDQU Gx, Ex */ nextop = F8; if(vex.l) { - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); } GETEX(0); GETGX; diff --git a/src/emu/x64runavx660f38.c b/src/emu/x64runavx660f38.c index 3d83d513..42e61f32 100644 --- a/src/emu/x64runavx660f38.c +++ b/src/emu/x64runavx660f38.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -539,7 +539,7 @@ uintptr_t RunAVX_660F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) GETEY; GETGY; GETVY; - if(!vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(!vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); if(GX==EX) { eax1 = *EX; EX = &eax1; @@ -992,7 +992,7 @@ uintptr_t RunAVX_660F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) GETEY; GETGY; GETVY; - if(!vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(!vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); if(GX==EX) { eax1 = *EX; EX = &eax1; @@ -1388,7 +1388,7 @@ uintptr_t RunAVX_660F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0x92: /* VGATHERDPD/VGATHERDPS Gx, VSIB, Vx */ nextop = F8; if(((nextop&7)!=4) || MODREG) { - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); } GETGX; GETVX; @@ -1455,7 +1455,7 @@ uintptr_t RunAVX_660F38(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) case 0x93: /* VGATHERQPD/VGATHERQPS Gx, VSIB, Vx */ nextop = F8; if(((nextop&7)!=4) || MODREG) { - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); } GETGX; GETVX; diff --git a/src/emu/x64runavx660f3a.c b/src/emu/x64runavx660f3a.c index 5c4292e9..42dcaf79 100644 --- a/src/emu/x64runavx660f3a.c +++ b/src/emu/x64runavx660f3a.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -99,7 +99,7 @@ uintptr_t RunAVX_660F3A(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) GETGY; GETEY; u8 = F8; - if(!vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(!vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); if(GX==EX) { eax1 = *EX; EX = &eax1; @@ -184,7 +184,7 @@ uintptr_t RunAVX_660F3A(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) GETGY; GETVY; u8 = F8; - if(!vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(!vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); if(GX==EX) { eax1 = *EX; EX = &eax1; @@ -767,7 +767,7 @@ uintptr_t RunAVX_660F3A(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) GETGY; GETVY; u8 = F8; - if(!vex.l) EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + if(!vex.l) EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); if(GX==EX) { eax1 = *EX; EX = &eax1; diff --git a/src/emu/x64runf20f.c b/src/emu/x64runf20f.c index 094499cf..1d1f080b 100644 --- a/src/emu/x64runf20f.c +++ b/src/emu/x64runf20f.c @@ -5,10 +5,10 @@ #include <math.h> #include <fenv.h> #include <string.h> -#include <signal.h> #include <sys/types.h> #include <unistd.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -301,7 +301,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) nextop = F8; if(!BOX64ENV(cputype) || !(MODREG)) { #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif } else { //TODO: test /r @@ -319,7 +319,7 @@ uintptr_t RunF20F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) nextop = F8; if(!BOX64ENV(cputype) || !(MODREG)) { #ifndef TEST_INTERPRETER - EmitSignal(emu, SIGILL, (void*)R_RIP, 0); + EmitSignal(emu, X64_SIGILL, (void*)R_RIP, 0); #endif } else { //TODO: test /r diff --git a/src/emu/x64syscall.c b/src/emu/x64syscall.c index 3392cdcc..7ca489c3 100644 --- a/src/emu/x64syscall.c +++ b/src/emu/x64syscall.c @@ -22,6 +22,7 @@ #include <poll.h> #include <sys/epoll.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -447,9 +448,9 @@ void EXPORT x64Syscall(x64emu_t *emu) if(box64_wine && !box64_is32bits) { //64bits only here... uintptr_t ret_addr = R_RIP-2; - if(/*ret_addr<0x700000000000LL &&*/ (my_context->signals[SIGSYS]>2) && !FindElfAddress(my_context, ret_addr)) { + if(/*ret_addr<0x700000000000LL &&*/ (my_context->signals[X64_SIGSYS]>2) && !FindElfAddress(my_context, ret_addr)) { // not a linux elf, not a syscall to setup x86_64 arch. Signal SIGSYS - EmitSignal(emu, SIGSYS, (void*)ret_addr, R_EAX&0xffff); // what are the parameters? + EmitSignal(emu, X64_SIGSYS, (void*)ret_addr, R_EAX&0xffff); // what are the parameters? return; } } @@ -825,6 +826,7 @@ void EXPORT x64Syscall(x64emu_t *emu) case 282: // sys_signalfd // need to mask SIGSEGV { + //TODO: convert the sigset from x64! sigset_t * set = (sigset_t *)R_RSI; if(sigismember(set, SIGSEGV)) { sigdelset(set, SIGSEGV); @@ -1132,6 +1134,7 @@ long EXPORT my_syscall(x64emu_t *emu) case 282: // sys_signalfd // need to mask SIGSEGV { + //TODO: convert sigset from x64 sigset_t * set = (sigset_t *)R_RDX; if(sigismember(set, SIGSEGV)) { sigdelset(set, SIGSEGV); diff --git a/src/emu/x86int3.c b/src/emu/x86int3.c index 72d218bb..15f5edc0 100755 --- a/src/emu/x86int3.c +++ b/src/emu/x86int3.c @@ -9,9 +9,9 @@ #include <sys/syscall.h> #include <sys/types.h> #include <pthread.h> -#include <signal.h> #include <inttypes.h> +#include "x64_signals.h" #include "os.h" #include "debug.h" #include "box64stack.h" @@ -484,9 +484,9 @@ void x86Int3(x64emu_t* emu, uintptr_t* addr) } return; } - if(!BOX64ENV(ignoreint3) && my_context->signals[SIGTRAP]) { + if(!BOX64ENV(ignoreint3) && my_context->signals[X64_SIGTRAP]) { R_RIP = *addr; // update RIP - EmitSignal(emu, SIGTRAP, NULL, 3); + EmitSignal(emu, X64_SIGTRAP, NULL, 3); } else { printf_log(LOG_DEBUG, "%04d|Warning, ignoring unsupported Int 3 call @%p\n", GetTID(), (void*)R_RIP); R_RIP = *addr; |