diff --git a/src/armv5te/cpu.cpp b/src/armv5te/cpu.cpp index 4281016..c9cc0cb 100644 --- a/src/armv5te/cpu.cpp +++ b/src/armv5te/cpu.cpp @@ -1,6 +1,7 @@ #include #include #include +#include // Uncomment the following line to measure the time until the OS is loaded // #define BENCHMARK @@ -115,11 +116,7 @@ void prefetch_abort(uint32_t mva, uint8_t status) cpu_exception(EX_PREFETCH_ABORT); if (mva == arm.reg[15]) error("Abort occurred with exception vectors unmapped"); - #ifndef NO_SETJMP - __builtin_longjmp(restart_after_exception, 1); - #else - assert(false); - #endif + longjmp(restart_after_exception, 1); } void data_abort(uint32_t mva, uint8_t status) @@ -130,11 +127,7 @@ void data_abort(uint32_t mva, uint8_t status) arm.fault_address = mva; arm.data_fault_status = status; cpu_exception(EX_DATA_ABORT); - #ifndef NO_SETJMP - __builtin_longjmp(restart_after_exception, 1); - #else - assert(false); - #endif + longjmp(restart_after_exception, 1); } void undefined_instruction() @@ -143,11 +136,7 @@ void undefined_instruction() warn("Undefined instruction at %08x\n", arm.reg[15]); arm.reg[15] += current_instr_size; cpu_exception(EX_UNDEFINED); - #ifndef NO_SETJMP - __builtin_longjmp(restart_after_exception, 1); - #else - assert(false); - #endif + longjmp(restart_after_exception, 1); } void *try_ptr(uint32_t addr) diff --git a/src/armv5te/emu.h b/src/armv5te/emu.h index 63ae8a9..1a495ce 100644 --- a/src/armv5te/emu.h +++ b/src/armv5te/emu.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "cpu.h" #include "mem.h" @@ -21,11 +22,6 @@ extern "C" { #define NO_TRANSLATION #endif -// on iOS, setjmp and longjmp are broken -#ifdef IS_IOS_BUILD -#define NO_SETJMP -#endif - static inline uint16_t BSWAP16(uint16_t x) { return x << 8 | x >> 8; } #define BSWAP32(x) __builtin_bswap32(x) @@ -55,7 +51,7 @@ enum { LOG_CPU, LOG_IO, LOG_FLASH, LOG_INTS, LOG_ICOUNT, LOG_USB, LOG_GDB, MAX_L // Is actually a jmp_buf, but __builtin_*jmp is used instead // as the MinGW variant is buggy -extern void *restart_after_exception[32]; +extern jmp_buf restart_after_exception; // GUI callbacks #define gui_debug_printf(...) debugLog(__VA_ARGS__) diff --git a/src/armv5te/emuVarPool.c b/src/armv5te/emuVarPool.c index a34af90..21bc6b3 100644 --- a/src/armv5te/emuVarPool.c +++ b/src/armv5te/emuVarPool.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "cpu.h" #include "mem.h" @@ -14,6 +15,6 @@ int cycle_count_delta; bool exiting; bool do_translate; -void *restart_after_exception[32]; +jmp_buf restart_after_exception; uint32_t cpu_events; diff --git a/src/pxa255/pxa255.c b/src/pxa255/pxa255.c index c09e405..576762c 100644 --- a/src/pxa255/pxa255.c +++ b/src/pxa255/pxa255.c @@ -1,5 +1,6 @@ #include #include +#include #include "pxa255_DMA.h" #include "pxa255_DSP.h" @@ -201,11 +202,7 @@ void pxa255Execute(bool wantVideo){ //TODO: need to set cycle_count_delta with the amount of opcodes to run cycle_count_delta = -500;//just a test value - // clang segfaults with that, for an iOS build :( -#ifndef NO_SETJMP - // Workaround for LLVM bug #18974 - while(__builtin_setjmp(restart_after_exception)){}; -#endif + while(setjmp(restart_after_exception)){}; exiting = false;//exiting is never set to true, maybe I should remove it? while (!exiting && cycle_count_delta < 0) {