- improved register update
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@787 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -28,6 +28,7 @@ typedef struct _sbp_t
|
||||
UINT32 instr;
|
||||
} bp_t;
|
||||
|
||||
static EXCEPTION_CONTEXT xcp_last;
|
||||
static bp_t user_bp[MAX_USER_BP];
|
||||
static bp_t mgmt_bp_ss[2];
|
||||
static bp_t mgmt_bp_ru[2];
|
||||
@@ -44,6 +45,18 @@ UINT32 BreakGetType(UINT32 instr)
|
||||
return (instr >> 6) & BP_MASK_TYPE;
|
||||
}
|
||||
|
||||
char* reg_changed(UINT32 reg1, UINT32 reg2)
|
||||
{
|
||||
static char chg_str[2] = {0};
|
||||
|
||||
if (reg1 != reg2)
|
||||
chg_str[0] = '*';
|
||||
else
|
||||
chg_str[0] = ' ';
|
||||
|
||||
return chg_str;
|
||||
}
|
||||
|
||||
void dbg_handler(struct xcptcontext * xcp)
|
||||
{
|
||||
|
||||
@@ -53,59 +66,61 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
UINT32 *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next;
|
||||
|
||||
sputs("\n");
|
||||
PRINT_REG(" Status : ", xcp->sr);
|
||||
PRINT_REG(" Cause : ", xcp->cr);
|
||||
PRINT_REG(" EPC : ", xcp->epc);
|
||||
PRINT_REG("BadAddr : ", xcp->baddr);
|
||||
PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr));
|
||||
PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr));
|
||||
PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc));
|
||||
PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr));
|
||||
sputs("\n");
|
||||
PRINT_REG(" MDLO : ", xcp->mdlo);
|
||||
PRINT_REG(" MDHI : ", xcp->mdhi);
|
||||
PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo));
|
||||
PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi));
|
||||
|
||||
sputs("\n");
|
||||
|
||||
sputs("Registers:\n");
|
||||
PRINT_REG(" 0 (ze) : ", xcp->regs[0]);
|
||||
PRINT_REG(" 1 (at) : ", xcp->regs[1]);
|
||||
PRINT_REG(" 2 (v0) : ", xcp->regs[2]);
|
||||
PRINT_REG(" 3 (v1) : ", xcp->regs[3]);
|
||||
PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0]));
|
||||
PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1]));
|
||||
PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2]));
|
||||
PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3]));
|
||||
sputs("\n");
|
||||
PRINT_REG(" 4 (a0) : ", xcp->regs[4]);
|
||||
PRINT_REG(" 5 (a1) : ", xcp->regs[5]);
|
||||
PRINT_REG(" 6 (a2) : ", xcp->regs[6]);
|
||||
PRINT_REG(" 7 (a3) : ", xcp->regs[7]);
|
||||
PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4]));
|
||||
PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5]));
|
||||
PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6]));
|
||||
PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7]));
|
||||
sputs("\n");
|
||||
PRINT_REG(" 8 (t0) : ", xcp->regs[8]);
|
||||
PRINT_REG(" 9 (t1) : ", xcp->regs[9]);
|
||||
PRINT_REG("10 (t2) : ", xcp->regs[10]);
|
||||
PRINT_REG("11 (t3) : ", xcp->regs[11]);
|
||||
PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8]));
|
||||
PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9]));
|
||||
PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10]));
|
||||
PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11]));
|
||||
sputs("\n");
|
||||
PRINT_REG("12 (t4) : ", xcp->regs[12]);
|
||||
PRINT_REG("13 (t5) : ", xcp->regs[13]);
|
||||
PRINT_REG("14 (t6) : ", xcp->regs[14]);
|
||||
PRINT_REG("15 (t7) : ", xcp->regs[15]);
|
||||
PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12]));
|
||||
PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13]));
|
||||
PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14]));
|
||||
PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15]));
|
||||
sputs("\n");
|
||||
PRINT_REG("16 (s0) : ", xcp->regs[16]);
|
||||
PRINT_REG("17 (s1) : ", xcp->regs[17]);
|
||||
PRINT_REG("18 (s2) : ", xcp->regs[18]);
|
||||
PRINT_REG("19 (s3) : ", xcp->regs[19]);
|
||||
PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16]));
|
||||
PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17]));
|
||||
PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18]));
|
||||
PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19]));
|
||||
sputs("\n");
|
||||
PRINT_REG("20 (s4) : ", xcp->regs[20]);
|
||||
PRINT_REG("21 (s5) : ", xcp->regs[21]);
|
||||
PRINT_REG("22 (s6) : ", xcp->regs[22]);
|
||||
PRINT_REG("23 (s7) : ", xcp->regs[23]);
|
||||
PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20]));
|
||||
PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21]));
|
||||
PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22]));
|
||||
PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23]));
|
||||
sputs("\n");
|
||||
PRINT_REG("24 (t8) : ", xcp->regs[24]);
|
||||
PRINT_REG("25 (t9) : ", xcp->regs[25]);
|
||||
PRINT_REG("26 (k0) : ", xcp->regs[26]);
|
||||
PRINT_REG("27 (k1) : ", xcp->regs[27]);
|
||||
PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24]));
|
||||
PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25]));
|
||||
PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26]));
|
||||
PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27]));
|
||||
sputs("\n");
|
||||
PRINT_REG("28 (gp) : ", xcp->regs[28]);
|
||||
PRINT_REG("29 (sp) : ", xcp->regs[29]);
|
||||
PRINT_REG("30 (fp) : ", xcp->regs[30]);
|
||||
PRINT_REG("31 (ra) : ", xcp->regs[31]);
|
||||
PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28]));
|
||||
PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29]));
|
||||
PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30]));
|
||||
PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31]));
|
||||
sputs("\n");
|
||||
sputs("\n");
|
||||
|
||||
memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT));
|
||||
|
||||
is_user_bp = 0;
|
||||
pAddr_curr = (UINT32*)xcp->epc;
|
||||
is_branch_shadow = ((xcp->cr & 0x80000000) == 0x80000000);
|
||||
@@ -351,7 +366,7 @@ int debug_break(struct xcptcontext * xcp)
|
||||
|
||||
void dbg_init(void)
|
||||
{
|
||||
|
||||
memset(&xcp_last, 0, sizeof(EXCEPTION_CONTEXT));
|
||||
interrupt_register(2, debug_int);
|
||||
interrupt_enable(2);
|
||||
|
||||
|
||||
@@ -42,6 +42,12 @@ typedef int (*fp_xcpt_t)(struct xcptcontext * xcp);
|
||||
sputs(" ");
|
||||
|
||||
|
||||
#define PRINT_REG_CHG(tag_str, reg, chg_tag) \
|
||||
sputs(tag_str); \
|
||||
print_word(reg); \
|
||||
sputs(chg_tag); \
|
||||
sputs(" ");
|
||||
|
||||
|
||||
// Public functions
|
||||
void xcpt_register(int xcpt_num, fp_xcpt_t fp);
|
||||
|
||||
Reference in New Issue
Block a user