mirror of
https://github.com/libretro/Mu.git
synced 2026-09-23 07:05:37 +00:00
Just use real setjmp
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <mutex>
|
||||
#include <setjmp.h>
|
||||
|
||||
// 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)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#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__)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#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;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#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) {
|
||||
|
||||
Reference in New Issue
Block a user