2002-05-14 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>

* src/m68k/rdbg_cpu_asm.S: Per PR163, Fix incorrect assumption that
	exception stack frames on M68K members with VBR always are 6 byte long.
	The incorrect assumption resulted in some gdb commands like "next"
	to fail on the 68360.
This commit is contained in:
Joel Sherrill
2002-05-14 15:13:52 +00:00
parent da6b86a1e7
commit 3695f03b66
2 changed files with 64 additions and 20 deletions

View File

@@ -1,3 +1,10 @@
2002-05-14 Thomas Doerfler <Thomas.Doerfler@imd-systems.de>
* src/m68k/rdbg_cpu_asm.S: Per PR163, Fix incorrect assumption that
exception stack frames on M68K members with VBR always are 6 byte long.
The incorrect assumption resulted in some gdb commands like "next"
to fail on the 68360.
2002-05-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2002-05-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* src/i386/any/remdeb_svc.c, src/m68k/any/remdeb_svc.c, * src/i386/any/remdeb_svc.c, src/m68k/any/remdeb_svc.c,

View File

@@ -98,37 +98,74 @@ SYM (enterRdbg):
PUBLIC (excHandler) PUBLIC (excHandler)
PUBLIC (BreakPointExcHdl) PUBLIC (BreakPointExcHdl)
SYM (excFormatLength):
/*
* size of exception stack frame depending on format type
* This is valid for m68k with VBR (68020/030/040/CPU32/CPU32+)
* size | format/name
*/
dc.w 4*2 | $0 standard
dc.w 4*2 | $1 throwaway stackframe
dc.w 6*2 | $2 CHK/CHK2/TRAPcc/TRAPV/DIV0/TRACE
dc.w 6*2 | $3 Coprocessor Post-Instruction (040)
dc.w 4*2 | $4 reserved
dc.w 4*2 | $5 reserved
dc.w 4*2 | $6 reserved
dc.w 30*2 | $7 Access Error (040)
dc.w 29*2 | $8 Bus Error (020)
dc.w 10*2 | $9 Coprocessor Mid-Instruction (020)
dc.w 16*2 | $A Short Bus-Error (020)
dc.w 46*2 | $B Long Bus-Error (020)
dc.w 12*2 | $C Bus Error/Address Error (CPU32)
dc.w 4*2 | $D reserved
dc.w 4*2 | $E reserved
dc.w 4*2 | $F reserved
SYM (excHandler): SYM (excHandler):
#if ( M68K_COLDFIRE_ARCH == 0 ) #if ( M68K_COLDFIRE_ARCH == 1 )
moveml d0-d1/a0-a1,a7@- | save d0-d1,a0-a1
movew a7@(16+FVO_OFFSET),d0 | d0 = F/VO
andl #0x0fff,d0 | d0 = vector offset in vbr
#else
lea a7@(-16),a7 lea a7@(-16),a7
movm.l d0-d1/a0-a1,a7@ | save d0-d1,a0-a1 movm.l d0-d1/a0-a1,a7@ | save d0-d1,a0-a1
movew a7@(16+FVO_OFFSET),d0 | d0 = F/VO movew a7@(16+FVO_OFFSET),d0 | d0 = F/VO
andl #0x0ffc,d0 | d0 = vector offset in vbr andl #0x0ffc,d0 | d0 = vector offset in vbr
#endif
lsrl #2,d0 | d0 = vector number lsrl #2,d0 | d0 = vector number
lea a7@(16),a1 | address of orig frame lea a7@(16),a1 | address of orig frame
lea a7@(16),a0 | address of orig frame lea a7@(16),a0 | address of orig frame
#if ( M68K_HAS_VBR == 0 ) lea a0@(8),a0 | skip exception frame
lea a0@(2),a0 | skip vector
#endif
lea a0@(6),a0 | a0 = orig sp
#if ( M68K_COLDFIRE_ARCH == 0 )
cmpiw #3,d0 | bus error or address error ?
#else #else
cmpi.l #3,d0 moveml d0-d1/a0-a1,a7@- | save d0-d1,a0-a1
#endif movew a7@(16+FVO_OFFSET),d0 | d0 = F/VO
bgt 1f | if >3 then normal exc
#if ( M68K_HAS_VBR == 1 ) #if ( M68K_HAS_VBR == 1 )
lea a1@(2*29),a0 movew d0,d1 | d1 is copy of F/VO
#else andl #0x0ffc,d0 | d0 = vector offset in vbr
lsrl #2,d0 | d0 = vector number
lsrl #8,d1
lsrl #3,d1
andl #0x001f,d1 | d1 is format number
lea SYM (excFormatLength),a1
movew a1@(d1),d1 | d1 = size of exc frame
lea a7@(16,d1),a0
lea a7@(16),a1 | address of orig frame
#else /* (M68k_HAS_VBR == 0) */
lea a7@(16),a1 | address of orig frame
lea a1@(6),a0 | skip stack frame
/*
* skip bus error stack frame...
*/
cmpi.l #3,d0
bgt 1f | if >3 then normal exc
lea a1@(8),a0 | skip extra stuff lea a1@(8),a0 | skip extra stuff
lea a0@(6),a0 | a0 = orig sp lea a0@(6),a0 | a0 = orig sp
#endif
1: 1:
#endif /* M68K_HAS_VBR */
#endif /* ( M68K_COLDFIRE_ARCH == 0 ) */
/*
* at this point:
* a0 points to stack above exception stack frame
* a1 points to start of exception stack frame
*/
movew a1@(SR_OFFSET),d1 | d1 = sr movew a1@(SR_OFFSET),d1 | d1 = sr
andl #0xffff,d1 andl #0xffff,d1
lea a7@(-76),a7 | reserve room for exception frame lea a7@(-76),a7 | reserve room for exception frame