- register more exceptions

- PC+4 if current PC points to breakpoint



git-svn-id: http://moon:8086/svn/mips@90 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-16 22:25:57 +00:00
parent 1f75695e9f
commit d125261048
2 changed files with 21 additions and 5 deletions
+11 -2
View File
@@ -8,6 +8,8 @@
#include "board.h" #include "board.h"
#include "../../regdef.h" #include "../../regdef.h"
#define DEBUGGER gdb_stub
extern uart_if_t uart_if[]; extern uart_if_t uart_if[];
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0])) #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
@@ -47,7 +49,7 @@ void dbg_uart_isr(struct xcptcontext *xcp)
char c = *dbg_uart->pDATA; char c = *dbg_uart->pDATA;
if (c == 3) if (c == 3)
{ {
gdb_stub(xcp); DEBUGGER(xcp);
} }
} }
} }
@@ -98,7 +100,14 @@ char dbg_getchar()
void dbg_init() void dbg_init()
{ {
xcpt_register(EXC_BP, gdb_stub); xcpt_register(EXC_ADEL, DEBUGGER);
xcpt_register(EXC_ADES, DEBUGGER);
xcpt_register(EXC_IBE, DEBUGGER);
xcpt_register(EXC_DBE, DEBUGGER);
xcpt_register(EXC_BP, DEBUGGER);
xcpt_register(EXC_RI, DEBUGGER);
xcpt_register(EXC_CPU, DEBUGGER);
xcpt_register(EXC_OV, DEBUGGER);
} }
void board_init(void) void board_init(void)
+9 -2
View File
@@ -402,6 +402,11 @@ hexToInt(char **ptr, unsigned long *intValue)
return (numChars); return (numChars);
} }
int isBreak(unsigned long instr)
{
return ((instr & 0xFC00003F) == 0x0000000D);
}
/* /*
* This function does all command procesing for interfacing to gdb. It * This function does all command procesing for interfacing to gdb. It
* returns 1 if you should skip the instruction at the trap address, 0 * returns 1 if you should skip the instruction at the trap address, 0
@@ -418,8 +423,10 @@ handle_exception (unsigned long *registers)
char *ptr; char *ptr;
unsigned long *sp; unsigned long *sp;
// branch shadow unsigned long *pAddr = (unsigned long *)registers[PC];
if (registers[CR] & 0x80000000)
// is break
if (isBreak(*pAddr))
{ {
registers[PC] += 4; registers[PC] += 4;
} }