diff options
| -rw-r--r-- | CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/dynarec/dynarec_native_functions.c | 1 | ||||
| -rw-r--r-- | src/emu/modrm.h | 6 | ||||
| -rw-r--r-- | src/emu/x64int3.c | 2 | ||||
| -rw-r--r-- | src/emu/x64run.c | 4 | ||||
| -rw-r--r-- | src/emu/x64run0f.c | 2 | ||||
| -rw-r--r-- | src/emu/x64run64.c | 2 | ||||
| -rw-r--r-- | src/emu/x64run660f.c | 2 | ||||
| -rw-r--r-- | src/emu/x64run670f.c | 2 | ||||
| -rw-r--r-- | src/emu/x64runavx0f.c | 2 | ||||
| -rw-r--r-- | src/emu/x64runavx0f38.c | 2 | ||||
| -rw-r--r-- | src/emu/x64runavx660f.c | 2 | ||||
| -rw-r--r-- | src/emu/x64runavx660f38.c | 2 | ||||
| -rw-r--r-- | src/emu/x64runavx660f3a.c | 2 | ||||
| -rw-r--r-- | src/emu/x64runf20f.c | 2 | ||||
| -rw-r--r-- | src/emu/x64syscall.c | 1 | ||||
| -rwxr-xr-x | src/emu/x86int3.c | 2 | ||||
| -rw-r--r-- | src/include/emit_signals.h | 13 | ||||
| -rw-r--r-- | src/include/os.h | 3 | ||||
| -rw-r--r-- | src/include/signals.h | 5 | ||||
| -rw-r--r-- | src/libtools/signals.c | 125 | ||||
| -rw-r--r-- | src/os/emit_signals_linux.c | 144 | ||||
| -rw-r--r-- | src/os/os_linux.c | 15 |
23 files changed, 177 insertions, 165 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5439362b..b21d1e4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -348,6 +348,7 @@ set_source_files_properties( set(OS_LINUX_SRC "${BOX64_ROOT}/src/os/backtrace.c" + "${BOX64_ROOT}/src/os/emit_signals_linux.c" "${BOX64_ROOT}/src/os/os_linux.c" ) diff --git a/src/dynarec/dynarec_native_functions.c b/src/dynarec/dynarec_native_functions.c index 5656dcac..e3813ff4 100644 --- a/src/dynarec/dynarec_native_functions.c +++ b/src/dynarec/dynarec_native_functions.c @@ -21,6 +21,7 @@ #include "emu/x87emu_private.h" #include "x64trace.h" #include "signals.h" +#include "emit_signals.h" #include "dynarec_native.h" #include "custommem.h" #include "bridge.h" diff --git a/src/emu/modrm.h b/src/emu/modrm.h index 4a1abd3e..cd2c3636 100644 --- a/src/emu/modrm.h +++ b/src/emu/modrm.h @@ -11,9 +11,9 @@ #define F64S *(int64_t*)(addr+=8, addr-8) #define PK(a) *(uint8_t*)(addr+a) #ifdef DYNAREC -#define STEP check_exec(emu, addr); if(step && !ACCESS_FLAG(F_TF)) return 0; -#define STEP2 check_exec(emu, addr); if(step && !ACCESS_FLAG(F_TF)) {R_RIP = addr; return 0;} -#define STEP3 check_exec(emu, addr); if(*step) (*step)++; +#define STEP CheckExec(emu, addr); if(step && !ACCESS_FLAG(F_TF)) return 0; +#define STEP2 CheckExec(emu, addr); if(step && !ACCESS_FLAG(F_TF)) {R_RIP = addr; return 0;} +#define STEP3 CheckExec(emu, addr); if(*step) (*step)++; #else #define STEP #define STEP2 diff --git a/src/emu/x64int3.c b/src/emu/x64int3.c index 82bfcb26..96776ce8 100644 --- a/src/emu/x64int3.c +++ b/src/emu/x64int3.c @@ -27,7 +27,7 @@ #include "wrapper.h" #include "box64context.h" #include "librarian.h" -#include "signals.h" +#include "emit_signals.h" #include "tools/bridge_private.h" #include <elf.h> diff --git a/src/emu/x64run.c b/src/emu/x64run.c index 7694ec13..05b3dd3f 100644 --- a/src/emu/x64run.c +++ b/src/emu/x64run.c @@ -20,7 +20,7 @@ #include "x87emu_private.h" #include "box64context.h" #include "alternate.h" -#include "signals.h" +#include "emit_signals.h" #ifdef DYNAREC #include "../dynarec/native_lock.h" #endif @@ -67,7 +67,7 @@ int Run(x64emu_t *emu, int step) #ifdef TEST_INTERPRETER test->memsize = 0; #else - check_exec(emu, R_RIP); + CheckExec(emu, R_RIP); x64emurun: while(1) #endif diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c index cd0affa8..94cd858a 100644 --- a/src/emu/x64run0f.c +++ b/src/emu/x64run0f.c @@ -22,7 +22,7 @@ #include "box64context.h" #include "my_cpuid.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #include "x64shaext.h" #ifdef DYNAREC #include "custommem.h" diff --git a/src/emu/x64run64.c b/src/emu/x64run64.c index 79ad60ae..62a94f26 100644 --- a/src/emu/x64run64.c +++ b/src/emu/x64run64.c @@ -19,7 +19,7 @@ #include "x87emu_private.h" #include "box64context.h" #include "alternate.h" -#include "signals.h" +#include "emit_signals.h" #include "modrm.h" diff --git a/src/emu/x64run660f.c b/src/emu/x64run660f.c index 27dc7af0..557b34a9 100644 --- a/src/emu/x64run660f.c +++ b/src/emu/x64run660f.c @@ -19,7 +19,7 @@ #include "x64trace.h" #include "x87emu_private.h" #include "box64context.h" -#include "signals.h" +#include "emit_signals.h" #include "bridge.h" #ifdef DYNAREC #include "custommem.h" diff --git a/src/emu/x64run670f.c b/src/emu/x64run670f.c index 72a5865e..870c8fac 100644 --- a/src/emu/x64run670f.c +++ b/src/emu/x64run670f.c @@ -19,7 +19,7 @@ #include "x87emu_private.h" #include "box64context.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #ifdef DYNAREC #include "../dynarec/native_lock.h" #endif diff --git a/src/emu/x64runavx0f.c b/src/emu/x64runavx0f.c index 81be8027..3da790c8 100644 --- a/src/emu/x64runavx0f.c +++ b/src/emu/x64runavx0f.c @@ -21,7 +21,7 @@ #include "box64context.h" #include "my_cpuid.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #include "x64shaext.h" #ifdef DYNAREC #include "custommem.h" diff --git a/src/emu/x64runavx0f38.c b/src/emu/x64runavx0f38.c index 178d95ac..2d647ec4 100644 --- a/src/emu/x64runavx0f38.c +++ b/src/emu/x64runavx0f38.c @@ -21,7 +21,7 @@ #include "box64context.h" #include "my_cpuid.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #ifdef DYNAREC #include "custommem.h" #include "../dynarec/native_lock.h" diff --git a/src/emu/x64runavx660f.c b/src/emu/x64runavx660f.c index 1597b63f..189cae05 100644 --- a/src/emu/x64runavx660f.c +++ b/src/emu/x64runavx660f.c @@ -21,7 +21,7 @@ #include "box64context.h" #include "my_cpuid.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #include "x64shaext.h" #ifdef DYNAREC #include "custommem.h" diff --git a/src/emu/x64runavx660f38.c b/src/emu/x64runavx660f38.c index 2fec0afb..fdde1d6c 100644 --- a/src/emu/x64runavx660f38.c +++ b/src/emu/x64runavx660f38.c @@ -21,7 +21,7 @@ #include "box64context.h" #include "my_cpuid.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #include "x64shaext.h" #ifdef DYNAREC #include "custommem.h" diff --git a/src/emu/x64runavx660f3a.c b/src/emu/x64runavx660f3a.c index 3985668e..c17d0e6f 100644 --- a/src/emu/x64runavx660f3a.c +++ b/src/emu/x64runavx660f3a.c @@ -21,7 +21,7 @@ #include "box64context.h" #include "my_cpuid.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #include "x64shaext.h" #include "x64compstrings.h" #ifdef DYNAREC diff --git a/src/emu/x64runf20f.c b/src/emu/x64runf20f.c index dc86c70f..0367d873 100644 --- a/src/emu/x64runf20f.c +++ b/src/emu/x64runf20f.c @@ -20,7 +20,7 @@ #include "x87emu_private.h" #include "box64context.h" #include "bridge.h" -#include "signals.h" +#include "emit_signals.h" #include "modrm.h" diff --git a/src/emu/x64syscall.c b/src/emu/x64syscall.c index 376809a7..2f418285 100644 --- a/src/emu/x64syscall.c +++ b/src/emu/x64syscall.c @@ -35,6 +35,7 @@ #include "box64context.h" #include "callback.h" #include "signals.h" +#include "emit_signals.h" #include "x64tls.h" #include "elfloader.h" diff --git a/src/emu/x86int3.c b/src/emu/x86int3.c index c9e5d190..7a2ea9f6 100755 --- a/src/emu/x86int3.c +++ b/src/emu/x86int3.c @@ -23,7 +23,7 @@ #include "wrapper32.h" #include "box32context.h" #include "librarian.h" -#include "signals.h" +#include "emit_signals.h" #include "tools/bridge_private.h" #include <elf.h> diff --git a/src/include/emit_signals.h b/src/include/emit_signals.h new file mode 100644 index 00000000..7bc4aa42 --- /dev/null +++ b/src/include/emit_signals.h @@ -0,0 +1,13 @@ +#ifndef __EMIT_SIGNALS_H_ +#define __EMIT_SIGNALS_H_ + +#include <stdint.h> + +typedef struct x64emu_s x64emu_t; + +void EmitSignal(x64emu_t* emu, int sig, void* addr, int code); +void EmitInterruption(x64emu_t* emu, int num, void* addr); +void EmitDiv0(x64emu_t* emu, void* addr, int code); +void CheckExec(x64emu_t* emu, uintptr_t addr); + +#endif // __EMIT_SIGNALS_H_ \ No newline at end of file diff --git a/src/include/os.h b/src/include/os.h index 2ab70722..d68a518b 100644 --- a/src/include/os.h +++ b/src/include/os.h @@ -36,9 +36,6 @@ int InternalMunmap(void* addr, unsigned long length); int GetTID(void); int SchedYield(void); -void EmitSignal(void* emu, int sig, void* addr, int code); -void EmitDiv0(void* emu, void* addr, int code); -void EmitInterruption(void* emu, int num, void* addr); void EmuX64Syscall(void* emu); void EmuX86Syscall(void* emu); diff --git a/src/include/signals.h b/src/include/signals.h index ffe2df04..497a5310 100644 --- a/src/include/signals.h +++ b/src/include/signals.h @@ -74,9 +74,4 @@ int my_syscall_rt_sigaction(x64emu_t* emu, int signum, const x64_sigaction_resto void init_signal_helper(box64context_t* context); void fini_signal_helper(void); -void emit_signal(x64emu_t* emu, int sig, void* addr, int code); -void emit_interruption(x64emu_t* emu, int num, void* addr); -void emit_div0(x64emu_t* emu, void* addr, int code); -void check_exec(x64emu_t* emu, uintptr_t addr); - #endif //__SIGNALS_H__ diff --git a/src/libtools/signals.c b/src/libtools/signals.c index 62081432..21e79cab 100644 --- a/src/libtools/signals.c +++ b/src/libtools/signals.c @@ -2078,131 +2078,6 @@ void my_sigactionhandler(int32_t sig, siginfo_t* info, void * ucntx) my_sigactionhandler_oldcode(emu, sig, 0, info, ucntx, NULL, db, x64pc); } -void emit_signal(x64emu_t* emu, int sig, void* addr, int code) -{ - siginfo_t info = {0}; - info.si_signo = sig; - info.si_errno = (sig==SIGSEGV)?0x1234:0; // Mark as a sign this is a #GP(0) (like privileged instruction) - info.si_code = code; - if(sig==SIGSEGV && code==0xbad0) { - info.si_errno = 0xbad0; - info.si_code = 0; - } else if(sig==SIGSEGV && code==0xecec) { - info.si_errno = 0xecec; - info.si_code = SEGV_ACCERR; - } else if (sig==SIGSEGV && code==0xb09d) { - info.si_errno = 0xb09d; - info.si_code = 0; - } - info.si_addr = addr; - const char* x64name = NULL; - const char* elfname = NULL; - if(BOX64ENV(log)>LOG_INFO || BOX64ENV(dynarec_dump) || BOX64ENV(showsegv)) { - x64name = getAddrFunctionName(R_RIP); - elfheader_t* elf = FindElfAddress(my_context, R_RIP); - if(elf) - elfname = ElfName(elf); - printf_log(LOG_NONE, "Emit Signal %d at IP=%p(%s / %s) / addr=%p, code=0x%x\n", sig, (void*)R_RIP, x64name?x64name:"???", elfname?elfname:"?", addr, code); - print_rolling_log(LOG_INFO); - - if((BOX64ENV(showbt) || sig==SIGABRT) && BOX64ENV(log)>=LOG_INFO) { - // show native bt - #define BT_BUF_SIZE 100 - int nptrs; - void *buffer[BT_BUF_SIZE]; - char **strings; - -#ifndef ANDROID - nptrs = backtrace(buffer, BT_BUF_SIZE); - strings = backtrace_symbols(buffer, nptrs); - if(strings) { - for (int j = 0; j < nptrs; j++) - printf_log(LOG_INFO, "NativeBT: %s\n", strings[j]); - free(strings); - } else - printf_log(LOG_INFO, "NativeBT: none (%d/%s)\n", errno, strerror(errno)); -#endif - extern int my_backtrace_ip(x64emu_t* emu, void** buffer, int size); // in wrappedlibc - extern char** my_backtrace_symbols(x64emu_t* emu, uintptr_t* buffer, int size); - // save and set real RIP/RSP - nptrs = my_backtrace_ip(emu, buffer, BT_BUF_SIZE); - strings = my_backtrace_symbols(emu, (uintptr_t*)buffer, nptrs); - if(strings) { - for (int j = 0; j < nptrs; j++) - printf_log(LOG_INFO, "EmulatedBT: %s\n", strings[j]); - free(strings); - } else - printf_log(LOG_INFO, "EmulatedBT: none\n"); - } -printf_log(LOG_NONE, DumpCPURegs(emu, R_RIP, emu->segs[_CS]==0x23)); -printf_log(LOG_NONE, "Emu Stack: %p 0x%lx%s\n", emu->init_stack, emu->size_stack, emu->stack2free?" owned":""); - //if(!elf) { - // FILE* f = fopen("/proc/self/maps", "r"); - // if(f) { - // char line[1024]; - // while(!feof(f)) { - // char* ret = fgets(line, sizeof(line), f); - // printf_log(LOG_NONE, "\t%s", ret); - // } - // fclose(f); - // } - //} - if(sig==SIGILL) { - uint8_t* mem = (uint8_t*)R_RIP; - printf_log(LOG_NONE, "SIGILL: Opcode at ip is %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", mem[0], mem[1], mem[2], mem[3], mem[4], mem[5]); - } - } - my_sigactionhandler_oldcode(emu, sig, 0, &info, NULL, NULL, NULL, R_RIP); -} - -void check_exec(x64emu_t* emu, uintptr_t addr) -{ - if(box64_pagesize!=4096) - return; //disabling the test, 4K pagesize simlation isn't good enough for this - while((getProtection_fast(addr)&(PROT_EXEC|PROT_READ))!=(PROT_EXEC|PROT_READ)) { - R_RIP = addr; // incase there is a slight difference - emit_signal(emu, SIGSEGV, (void*)addr, 0xecec); - } -} - -void emit_interruption(x64emu_t* emu, int num, void* addr) -{ - siginfo_t info = {0}; - info.si_signo = SIGSEGV; - info.si_errno = 0xdead; - info.si_code = num; - info.si_addr = NULL;//addr; - const char* x64name = NULL; - const char* elfname = NULL; - if(BOX64ENV(log)>LOG_INFO || BOX64ENV(dynarec_dump) || BOX64ENV(showsegv)) { - x64name = getAddrFunctionName(R_RIP); - elfheader_t* elf = FindElfAddress(my_context, R_RIP); - if(elf) - elfname = ElfName(elf); - printf_log(LOG_NONE, "Emit Interruption 0x%x at IP=%p(%s / %s) / addr=%p\n", num, (void*)R_RIP, x64name?x64name:"???", elfname?elfname:"?", addr); - } - my_sigactionhandler_oldcode(emu, SIGSEGV, 0, &info, NULL, NULL, NULL, R_RIP); -} - -void emit_div0(x64emu_t* emu, void* addr, int code) -{ - siginfo_t info = {0}; - info.si_signo = SIGSEGV; - info.si_errno = 0xcafe; - info.si_code = code; - info.si_addr = addr; - const char* x64name = NULL; - const char* elfname = NULL; - if(BOX64ENV(log)>LOG_INFO || BOX64ENV(dynarec_dump) || BOX64ENV(showsegv)) { - x64name = getAddrFunctionName(R_RIP); - elfheader_t* elf = FindElfAddress(my_context, R_RIP); - if(elf) - elfname = ElfName(elf); - printf_log(LOG_NONE, "Emit Divide by 0 at IP=%p(%s / %s) / addr=%p\n", (void*)R_RIP, x64name?x64name:"???", elfname?elfname:"?", addr); - } - my_sigactionhandler_oldcode(emu, SIGSEGV, 0, &info, NULL, NULL, NULL, R_RIP); -} - EXPORT sighandler_t my_signal(x64emu_t* emu, int signum, sighandler_t handler) { if(signum<0 || signum>MAX_SIGNAL) diff --git a/src/os/emit_signals_linux.c b/src/os/emit_signals_linux.c new file mode 100644 index 00000000..6df070d5 --- /dev/null +++ b/src/os/emit_signals_linux.c @@ -0,0 +1,144 @@ +#include <errno.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#ifndef ANDROID +#include <execinfo.h> +#endif + +#include "box64context.h" +#include "custommem.h" +#include "debug.h" +#include "elfloader.h" +#include "emit_signals.h" +#include "emu/x64emu_private.h" +#include "regs.h" +#include "signals.h" +#include "x64emu.h" + +void my_sigactionhandler_oldcode(x64emu_t* emu, int32_t sig, int simple, siginfo_t* info, void * ucntx, int* old_code, void* cur_db, uintptr_t x64pc); +void EmitSignal(x64emu_t* emu, int sig, void* addr, int code) +{ + siginfo_t info = { 0 }; + info.si_signo = sig; + info.si_errno = (sig == SIGSEGV) ? 0x1234 : 0; // Mark as a sign this is a #GP(0) (like privileged instruction) + info.si_code = code; + if (sig == SIGSEGV && code == 0xbad0) { + info.si_errno = 0xbad0; + info.si_code = 0; + } else if (sig == SIGSEGV && code == 0xecec) { + info.si_errno = 0xecec; + info.si_code = SEGV_ACCERR; + } else if (sig == SIGSEGV && code == 0xb09d) { + info.si_errno = 0xb09d; + info.si_code = 0; + } + info.si_addr = addr; + const char* x64name = NULL; + const char* elfname = NULL; + if (BOX64ENV(log) > LOG_INFO || BOX64ENV(dynarec_dump) || BOX64ENV(showsegv)) { + x64name = getAddrFunctionName(R_RIP); + elfheader_t* elf = FindElfAddress(my_context, R_RIP); + if (elf) + elfname = ElfName(elf); + printf_log(LOG_NONE, "Emit Signal %d at IP=%p(%s / %s) / addr=%p, code=0x%x\n", sig, (void*)R_RIP, x64name ? x64name : "???", elfname ? elfname : "?", addr, code); + print_rolling_log(LOG_INFO); + + if ((BOX64ENV(showbt) || sig == SIGABRT) && BOX64ENV(log) >= LOG_INFO) { + // show native bt + #define BT_BUF_SIZE 100 + int nptrs; + void* buffer[BT_BUF_SIZE]; + char** strings; + + #ifndef ANDROID + nptrs = backtrace(buffer, BT_BUF_SIZE); + strings = backtrace_symbols(buffer, nptrs); + if (strings) { + for (int j = 0; j < nptrs; j++) + printf_log(LOG_INFO, "NativeBT: %s\n", strings[j]); + free(strings); + } else + printf_log(LOG_INFO, "NativeBT: none (%d/%s)\n", errno, strerror(errno)); + #endif + extern int my_backtrace_ip(x64emu_t * emu, void** buffer, int size); // in wrappedlibc + extern char** my_backtrace_symbols(x64emu_t * emu, uintptr_t * buffer, int size); + // save and set real RIP/RSP + nptrs = my_backtrace_ip(emu, buffer, BT_BUF_SIZE); + strings = my_backtrace_symbols(emu, (uintptr_t*)buffer, nptrs); + if (strings) { + for (int j = 0; j < nptrs; j++) + printf_log(LOG_INFO, "EmulatedBT: %s\n", strings[j]); + free(strings); + } else + printf_log(LOG_INFO, "EmulatedBT: none\n"); + } + printf_log(LOG_NONE, DumpCPURegs(emu, R_RIP, emu->segs[_CS] == 0x23)); + printf_log(LOG_NONE, "Emu Stack: %p 0x%lx%s\n", emu->init_stack, emu->size_stack, emu->stack2free ? " owned" : ""); + // if(!elf) { + // FILE* f = fopen("/proc/self/maps", "r"); + // if(f) { + // char line[1024]; + // while(!feof(f)) { + // char* ret = fgets(line, sizeof(line), f); + // printf_log(LOG_NONE, "\t%s", ret); + // } + // fclose(f); + // } + // } + if (sig == SIGILL) { + uint8_t* mem = (uint8_t*)R_RIP; + printf_log(LOG_NONE, "SIGILL: Opcode at ip is %02hhx %02hhx %02hhx %02hhx %02hhx %02hhx\n", mem[0], mem[1], mem[2], mem[3], mem[4], mem[5]); + } + } + my_sigactionhandler_oldcode(emu, sig, 0, &info, NULL, NULL, NULL, R_RIP); +} + +void CheckExec(x64emu_t* emu, uintptr_t addr) +{ + if (box64_pagesize != 4096) + return; // disabling the test, 4K pagesize simlation isn't good enough for this + while ((getProtection_fast(addr) & (PROT_EXEC | PROT_READ)) != (PROT_EXEC | PROT_READ)) { + R_RIP = addr; // incase there is a slight difference + EmitSignal(emu, SIGSEGV, (void*)addr, 0xecec); + } +} + +void EmitInterruption(x64emu_t* emu, int num, void* addr) +{ + siginfo_t info = { 0 }; + info.si_signo = SIGSEGV; + info.si_errno = 0xdead; + info.si_code = num; + info.si_addr = NULL; // addr; + const char* x64name = NULL; + const char* elfname = NULL; + if (BOX64ENV(log) > LOG_INFO || BOX64ENV(dynarec_dump) || BOX64ENV(showsegv)) { + x64name = getAddrFunctionName(R_RIP); + elfheader_t* elf = FindElfAddress(my_context, R_RIP); + if (elf) + elfname = ElfName(elf); + printf_log(LOG_NONE, "Emit Interruption 0x%x at IP=%p(%s / %s) / addr=%p\n", num, (void*)R_RIP, x64name ? x64name : "???", elfname ? elfname : "?", addr); + } + my_sigactionhandler_oldcode(emu, SIGSEGV, 0, &info, NULL, NULL, NULL, R_RIP); +} + +void EmitDiv0(x64emu_t* emu, void* addr, int code) +{ + siginfo_t info = { 0 }; + info.si_signo = SIGSEGV; + info.si_errno = 0xcafe; + info.si_code = code; + info.si_addr = addr; + const char* x64name = NULL; + const char* elfname = NULL; + if (BOX64ENV(log) > LOG_INFO || BOX64ENV(dynarec_dump) || BOX64ENV(showsegv)) { + x64name = getAddrFunctionName(R_RIP); + elfheader_t* elf = FindElfAddress(my_context, R_RIP); + if (elf) + elfname = ElfName(elf); + printf_log(LOG_NONE, "Emit Divide by 0 at IP=%p(%s / %s) / addr=%p\n", (void*)R_RIP, x64name ? x64name : "???", elfname ? elfname : "?", addr); + } + my_sigactionhandler_oldcode(emu, SIGSEGV, 0, &info, NULL, NULL, NULL, R_RIP); +} diff --git a/src/os/os_linux.c b/src/os/os_linux.c index e11a41a2..daef3807 100644 --- a/src/os/os_linux.c +++ b/src/os/os_linux.c @@ -19,21 +19,6 @@ int SchedYield(void) return sched_yield(); } -void EmitSignal(void* emu, int sig, void* addr, int code) -{ - return emit_signal((x64emu_t*)emu, sig, addr, code); -} - -void EmitDiv0(void* emu, void* addr, int code) -{ - return emit_div0((x64emu_t*)emu, addr, code); -} - -void EmitInterruption(void* emu, int num, void* addr) -{ - return emit_interruption((x64emu_t*)emu, num, addr); -} - int IsBridgeSignature(char s, char c) { return s == 'S' && c == 'C'; |