From e09fc7f6637189da494cecc498f6a03e30d9536e Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 2 Oct 2020 20:20:45 +0300 Subject: [PATCH] 4500b3 --- include/readcpu.h | 4 ++++ jit/compemu_support.cpp | 2 +- newcpu.cpp | 2 +- od-win32/srcrelease.cmd | 2 +- od-win32/win32.cpp | 10 ++++++++++ traps.cpp | 34 ++++++++++++++++++++++++++++------ 6 files changed, 45 insertions(+), 9 deletions(-) diff --git a/include/readcpu.h b/include/readcpu.h index 224cd0ec..122556b0 100644 --- a/include/readcpu.h +++ b/include/readcpu.h @@ -70,8 +70,12 @@ ENUMDECL { fl_return = 3, fl_trap = 4, fl_const_jump = 8, +#ifdef UAE + fl_end_block = 7 +#else /* Instructions that can trap don't mark the end of a block */ fl_end_block = 3 +#endif } ENUMNAME (cflow_t); ENUMDECL { diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index b70eaea4..42939db8 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -4379,7 +4379,7 @@ void build_comp(void) int isaddx; int cflow; - if ((instrmnem)table68k[opcode].mnemo == i_ILLG || table68k[opcode].clev > cpu_level) + if (table68k[opcode].mnemo == i_ILLG || table68k[opcode].clev > cpu_level) continue; if (table68k[opcode].handler != -1) { diff --git a/newcpu.cpp b/newcpu.cpp index 5b2f8403..1f66768e 100644 --- a/newcpu.cpp +++ b/newcpu.cpp @@ -9750,11 +9750,11 @@ void fill_prefetch_030(void) void fill_prefetch (void) { - reset_pipeline_state(); if (currprefs.cachesize) return; if (!currprefs.cpu_compatible) return; + reset_pipeline_state(); if (currprefs.cpu_model >= 68040) { if (currprefs.cpu_compatible || currprefs.cpu_memory_cycle_exact) { fill_icache040(m68k_getpc() + 16); diff --git a/od-win32/srcrelease.cmd b/od-win32/srcrelease.cmd index e526c2e8..becda1bc 100644 --- a/od-win32/srcrelease.cmd +++ b/od-win32/srcrelease.cmd @@ -6,7 +6,7 @@ cd .. del ..\winuaesrc.7z -7z a -r ..\winuaesrc *.c *.cpp *.h *.sln *.vcxproj* *.ico *.rc *.bmp *.cur *.manifest *.png *.txt +7z a -r ..\winuaesrc *.c *.cpp *.h *.sln *.vcxproj* *.ico *.rc *.bmp *.cur *.manifest *.png *.txt *.def *.asm *.hlsl *.inl *.wav copy ..\winuaesrc.7z d:\amiga\winuaepackets\winuaesrc%1.7z copy ..\winuaesrc.7z d:\amiga /y diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 85952882..a1845169 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -136,6 +136,7 @@ OSVERSIONINFO osVersion; static SYSTEM_INFO SystemInfo; static int logging_started; static MINIDUMP_TYPE minidumpmode = MiniDumpNormal; +static int nocrashdump; static int doquit; static int console_started; void *globalipc; @@ -6588,6 +6589,10 @@ static int parseargs(const TCHAR *argx, const TCHAR *np, const TCHAR *np2) resetgui_pending = true; return 1; } + if (!_tcscmp(arg, _T("nocrashdump"))) { + nocrashdump = 1; + return 1; + } if (!np) return 0; @@ -7306,6 +7311,8 @@ static void create_dump (struct _EXCEPTION_POINTERS *pExceptionPointers) LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS * pExceptionPointers, DWORD ec) { + if (nocrashdump || isfullscreen() > 0) + EXCEPTION_CONTINUE_SEARCH; write_log (_T("EVALEXCEPTION %08x!\n"), ec); create_dump (pExceptionPointers); return EXCEPTION_CONTINUE_SEARCH; @@ -7329,6 +7336,9 @@ static void efix (DWORD *regp, void *p, void *ps, int *got) LONG WINAPI WIN32_ExceptionFilter (struct _EXCEPTION_POINTERS *pExceptionPointers, DWORD ec) { + if (nocrashdump) + EXCEPTION_CONTINUE_SEARCH; + static uae_u8 *prevpc; LONG lRet = EXCEPTION_CONTINUE_SEARCH; PEXCEPTION_RECORD er = pExceptionPointers->ExceptionRecord; diff --git a/traps.cpp b/traps.cpp index 418e7eb1..213f9bfd 100644 --- a/traps.cpp +++ b/traps.cpp @@ -151,9 +151,6 @@ void REGPARAM2 m68k_handle_trap (unsigned int trap_num) int has_retval = (trap->flags & TRAPFLAG_NO_RETVAL) == 0; int implicit_rts = (trap->flags & TRAPFLAG_DORET) != 0; - if (trap->name && trap->name[0] != 0 && trace_traps) - write_log (_T("TRAP: %s\n"), trap->name); - if (trap_num < trap_count) { if (trap->flags & TRAPFLAG_EXTRA_STACK) { /* Handle an extended trap. @@ -161,9 +158,17 @@ void REGPARAM2 m68k_handle_trap (unsigned int trap_num) * space via a separate, dedicated simple trap which the trap * handler causes to be invoked when it is done. */ + + if (trap->name && trap->name[0] != 0 && trace_traps) + write_log(_T("XTRAP: %s\n"), trap->name); + trap_HandleExtendedTrap (trap->handler, has_retval); } else { /* Handle simple trap */ + + if (trap->name && trap->name[0] != 0 && trace_traps) + write_log(_T("TRAP: %s\n"), trap->name); + retval = (trap->handler) (NULL); if (has_retval) @@ -334,6 +339,10 @@ static void trap_HandleExtendedTrap(TrapHandler handler_func, int has_retval) * It'll do this when the trap handler is done - or when * the handler wants to call 68k code. */ uae_sem_wait(&context->switch_to_emu_sem); + + if (trace_traps) { + write_log(_T("Exit extended trap PC=%08x\n"), m68k_getpc()); + } } } @@ -370,6 +379,10 @@ static uae_u32 trap_Call68k(TrapContext *ctx, uaecptr func_addr) m68k_setpc(m68k_call_trapaddr); fill_prefetch(); + if (trace_traps) { + write_log(_T("Calling m68k PC=%08x %08x\n"), func_addr, m68k_call_trapaddr); + } + /* Switch to emulator context. */ uae_sem_post(&ctx->switch_to_emu_sem); @@ -412,12 +425,12 @@ static uae_u32 REGPARAM2 m68k_call_handler(TrapContext *dummy_ctx) m68k_setpc(context->call68k_func_addr); fill_prefetch(); - /* End critical section: allow other traps run. */ - uae_sem_post(&trap_mutex); - /* Restore interrupts. */ regs.intmask = context->saved_regs.intmask; + /* End critical section: allow other traps run. */ + uae_sem_post(&trap_mutex); + /* Dummy return value. */ return 0; } @@ -430,6 +443,11 @@ static uae_u32 REGPARAM2 m68k_return_handler(TrapContext *dummy_ctx) TrapContext *context; uae_u32 sp; + if (trace_traps) { + write_log(_T("m68k_return_handler\n")); + } + + /* One trap returning at a time, please! */ uae_sem_wait(&trap_mutex); @@ -463,6 +481,10 @@ static uae_u32 REGPARAM2 exit_trap_handler(TrapContext *dummy_ctx) { TrapContext *context = current_context; + if (trace_traps) { + write_log(_T("exit_trap_handler waiting PC=%08x\n"), context->saved_regs.pc); + } + /* Wait for trap context thread to exit. */ uae_wait_thread(context->thread); -- 2.47.3