[hatari-devel] New WinUAE CPU core debugging support |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
I'm getting huge/unreasonable amounts of "Illegal *put" messages from
new WinUAE CPU core with 32-bit addressing. They won't invoke any
exceptions, so they cannot be trapped by debugger.
Grepping sources shows them to come from dummy_*put() functions.
I'm getting them with BadMood started in this way:
$ hatari -s 14 --addr24 false --machine falcon ...
(I assume BM never finishing loading / outputting sound is
it just being incompatible with 32-bit addressing, not an
issue with Hatari. It happens regardless of whether any
TT-RAM is specified.)
After adding attached patch to Hatari (and using "--debug-except bus"),
I'm seeing messagees coming from stuff like this:
-------------
Illegal lput at 0eb91df0=00000000 PC=15e12
CPU=$15e12, VBL=982, FrameCycles=148822, HBL=290, LineCycles=342, DSP=$1046
$00015e12 : 4298 clr.l (a0)+
> disasm $00015e00
$00015e00 : caf0 2400 mulu.w (a0,d2.w*4),d5
$00015e04 : 0682 0000 2000 addi.l #$2000,d2
$00015e0a : 508f addq.l #8,sp
$00015e0c : 22c0 move.l d0,(a1)+
$00015e0e : 2040 movea.l d0,a0
$00015e10 : 4241 clr.w d1
$00015e12 : 4298 clr.l (a0)+
$00015e14 : 5241 addq.w #1,d1
> r
D0 0EB91DF0 D1 00000000 D2 0EB93DF0 D3 00000010
D4 000FC6E8 D5 8F000000 D6 00000801 D7 FFFFFFFC
A0 0EB91DF4 A1 000FCAF4 A2 0005ED28 A3 000000CF
A4 0000A0BC A5 00000800 A6 0000000B A7 00200684
USP 0023FD7E ISP 00200684 SFC 00000000 DFC 00000000
CACR 00002101 VBR 00000000 CAAR 00000000 MSP 00000000
T=00 S=1 M=0 X=0 N=0 Z=1 V=0 C=0 IMASK=3 STP=0
FP0: nan FP1: nan FP2: nan FP3: nan
FP4: nan FP5: nan FP6: nan FP7: nan
FPSR: 4000000 FPCR: 00000000 FPIAR: 00000000 N=0 Z=1 I=0 NAN=0
Prefetch 5241 (ADD) 0000 (OR) Chip latch 00000000
00015E12 4298 CLR.L (A0)+
Next PC: 00015e14
-------------
Why addresses like that (0xeb91df0 = 235MB) go to dummy banks
instead of causing bus errors?
Btw. When looking more into exception debugging support, I noticed that
new WinUAE CPU core is also missing this stuff from old UAE CPU core:
----------------------
/* Check for double bus errors: */
if (regs.spcflags & SPCFLAG_BUSERROR) {
fprintf(stderr, "Detected double bus error at address $%x,
PC=$%lx => CPU halted!\n",
BusErrorAddress, (long)currpc);
unset_special(SPCFLAG_BUSERROR);
if (ExceptionDebugMask & EXCEPT_BUS)
DebugUI(REASON_CPU_EXCEPTION);
else
DlgAlert_Notice("Detected double bus error => CPU halted!
\nEmulation needs to be reset.\n");
regs.intmask = 7;
m68k_setstopped(true);
return;
}
if ((ExceptionDebugMask & EXCEPT_BUS) &&
BusErrorAddress!=0xff8a00) {
fprintf(stderr,"Bus Error at address $%x, PC=$%lx\n",
BusErrorAddress, (long)currpc);
DebugUI(REASON_CPU_EXCEPTION);
}
}
}
/* Set PC and flags */
if ((ExceptionDebugMask & EXCEPT_NOHANDLER) && (regs.vbr + 4*nr) == 0) {
fprintf(stderr,"Uninitialized exception handler #%i!\n", nr);
DebugUI(REASON_CPU_EXCEPTION);
}
newpc = get_long (regs.vbr + 4*nr);
if ( newpc & 1) /* check new pc is even */
{
if ( nr==2 || nr==3 ) /* address error during
bus/address error -> stop emulation */
{
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, new
PC=$%x\n",newpc);
Exception ( 3 , m68k_getpc() , M68000_EXC_SRC_CPU );
}
return;
}
----------------------
Old UAE core:
* prevents Hatari from taking all CPU looping unrecoverable
exceptions and instead notifies user about it (either by dialog,
or by invoking debugger if exception debugging is enabled).
* supports "no exception handler" debugger case
- Eero
diff -r 03c949a41e8b src/cpu/memory.c
--- a/src/cpu/memory.c Sun Dec 28 22:26:29 2014 +0200
+++ b/src/cpu/memory.c Sun Dec 28 23:00:33 2014 +0200
@@ -27,6 +27,7 @@
#include "stMemory.h"
#include "m68000.h"
#include "configuration.h"
+#include "debugui.h"
#include "newcpu.h"
@@ -216,13 +217,19 @@
if (ins) {
write_log (_T("WARNING: Illegal opcode %cget at %08x PC=%x\n"),
size == 2 ? 'w' : 'l', addr, M68K_GETPC);
- } else if (rw) {
+ if (ExceptionDebugMask & EXCEPT_ILLEGAL)
+ DebugUI(REASON_CPU_EXCEPTION);
+ return;
+ }
+ if (rw) {
write_log (_T("Illegal %cput at %08x=%08x PC=%x\n"),
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, val, M68K_GETPC);
} else {
write_log (_T("Illegal %cget at %08x PC=%x\n"),
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, M68K_GETPC);
}
+ if (ExceptionDebugMask & EXCEPT_BUS)
+ DebugUI(REASON_CPU_EXCEPTION);
}
void dummy_put (uaecptr addr, int size, uae_u32 val)