Re: [hatari-devel] Error dialog needs cold reset button |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Le 16/03/2015 00:19, Nicolas Pomarède a écrit :
I don't think it gives problem to call Reset() outside of the main input
loop (although I didn't try it). But we should call Reset_Warm() in
fact, as on a real STF you would likely press the reset button, which
does a warm, not cold, reset.
You can modify old cpu core if you like, if it's OK I will add the
changes to WinUAE's cpu (which has a different/better "halt" state)
Nicolas
Hi
back to this topic, I made some changse to handle the 'halt' state and
display a dialog box in such case to let the user do a warm reset or
call the debugger, instead of being locked in an endless loop.
David, can you test with your case ?
In my case, a way to trigger double bus/address error is to run tos3.06
in tt mode, but with a 68000 and 24 bit addresssing (instead of the 32
required), which is not compatible.
eg :
../hatari --tos tos306fr.img --machine tt
This will crash during the RAM detection and show the new dialog.
Apply the following patch to test with old cpu core ; if it works for
you, I will add a similar dialog to the WinUAE cpu core.
Nicolas
diff -r 0097eb037404 src/uae-cpu/newcpu.c
--- a/src/uae-cpu/newcpu.c Tue May 12 19:00:47 2015 +0300
+++ b/src/uae-cpu/newcpu.c Wed May 13 15:01:27 2015 +0200
@@ -146,6 +146,7 @@
#include "newcpu.h"
#include "main.h"
#include "m68000.h"
+#include "reset.h"
#include "cycInt.h"
#include "mfp.h"
#include "tos.h"
@@ -252,6 +253,27 @@
}
#endif
+int do_print=0;
+static void cpu_halt ( void )
+{
+ int res;
+
+// unset_special(SPCFLAG_BUSERROR);
+
+ res = DlgAlert_Query ( "Detected double bus/address error => CPU halted !\n\n Press OK to reset or CANCEL for debugger\n");
+
+ if ( res )
+ {
+printf ( "halt 1 %x\n" , regs.spcflags );
+ Reset_Warm(); /* Reset to exit 'halt' state (reset cpu and regs.spcflags) */
+// regs.spcflags |= SPCFLAG_MODE_CHANGE;
+printf ( "halt 2 %x\n" , regs.spcflags );
+ }
+ else
+ DebugUI(REASON_CPU_EXCEPTION);
+}
+
+
static unsigned long op_illg_1 (uae_u32 opcode) REGPARAM;
@@ -1052,6 +1074,7 @@
/* Check for double bus errors: */
if (regs.spcflags & SPCFLAG_BUSERROR) {
+#if 0
fprintf(stderr, "Detected double bus error at address $%x, PC=$%lx => CPU halted!\n",
BusErrorAddress, (long)currpc);
unset_special(SPCFLAG_BUSERROR);
@@ -1061,6 +1084,11 @@
DlgAlert_Notice("Detected double bus error => CPU halted!\nEmulation needs to be reset.\n");
regs.intmask = 7;
m68k_setstopped(true);
+#else
+ fprintf(stderr, "Detected double bus error at address $%x, PC=$%lx => CPU halted!\n",
+ BusErrorAddress, (long)currpc);
+ cpu_halt();
+#endif
return;
}
if ((ExceptionDebugMask & EXCEPT_BUS) && BusErrorAddress!=0xff8a00) {
@@ -1080,11 +1108,16 @@
{
if ( nr==2 || nr==3 ) /* address error during bus/address error -> stop emulation */
{
+#if 0
fprintf(stderr,"Address Error during exception 2/3, aborting new PC=$%x\n",newpc);
if (ExceptionDebugMask & (EXCEPT_BUS|EXCEPT_ADDRESS))
DebugUI(REASON_CPU_EXCEPTION);
else
DlgAlert_Notice("Address Error during exception 2/3 => CPU halted!\nEmulation needs to be reset.\n");
+#else
+ fprintf(stderr,"Address Error during exception 2/3, new PC=$%x => CPU halted\n",newpc);
+ cpu_halt();
+#endif
}
else
{
@@ -1534,9 +1567,13 @@
regs.vbr = regs.sfc = regs.dfc = 0;
regs.fpcr = regs.fpsr = regs.fpiar = 0;
+STMemory_WriteLong(0,STMemory_ReadLong(0xe00000));
+STMemory_WriteLong(4,STMemory_ReadLong(0xe00004));
m68k_areg(regs, 7) = get_long(0);
m68k_setpc(get_long(4));
+printf ( "res 3 %x %x %x %x\n" , regs.spcflags, m68k_getpc() , get_long(0), get_long(8) );
refill_prefetch (m68k_getpc(), 0);
+printf ( "res 4 %x %x\n" , regs.spcflags, m68k_getpc() );
}
@@ -1746,10 +1783,14 @@
for (;;) {
int cycles;
//fprintf (stderr, "ir in %x %x\n",do_get_mem_long(®s.prefetch) , regs.prefetch_pc);
+if ( do_print ) printf ( "run loop0 %x\n" , regs.spcflags );
regs.opcode = get_iword_prefetch (0);
+if ( do_print ) printf ( "run loop1 %x\n" , regs.spcflags );
+
if (regs.spcflags & SPCFLAG_BUSERROR)
{
+printf ( "bus1\n" );
unset_special(SPCFLAG_BUSERROR);
Exception(2,0,M68000_EXC_SRC_CPU);
@@ -1760,6 +1801,7 @@
return;
}
}
+if ( do_print ) printf ( "run loop2\n" );
#ifdef DEBUG_PREFETCH
// if (get_ilong (0) != do_get_mem_long (®s.prefetch)) {