aboutsummaryrefslogtreecommitdiff
path: root/sim/mips/gencode.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/mips/gencode.c')
-rw-r--r--sim/mips/gencode.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sim/mips/gencode.c b/sim/mips/gencode.c
index 928b88e..2e5ed28 100644
--- a/sim/mips/gencode.c
+++ b/sim/mips/gencode.c
@@ -2716,6 +2716,24 @@ build_instruction (doisa, features, mips16, insn)
break ;
case BREAK:
+
+ printf(" unsigned int break_code = instruction & HALT_INSTRUCTION_MASK;\n");
+ printf(" if ( break_code == (HALT_INSTRUCTION & HALT_INSTRUCTION_MASK)\n");
+ printf(" || break_code == (HALT_INSTRUCTION2 & HALT_INSTRUCTION_MASK))\n");
+ printf(" {\n");
+ printf(" sim_engine_halt (SD, CPU, NULL, cia,\n");
+ printf(" sim_exited, (unsigned int)(A0 & 0xFFFFFFFF));\n");
+ printf(" }\n");
+ printf(" else if ( break_code == (BREAKPOINT_INSTRUCTION & HALT_INSTRUCTION_MASK)\n");
+ printf(" || break_code == (BREAKPOINT_INSTRUCTION2 & HALT_INSTRUCTION_MASK))\n");
+ printf(" {\n");
+ printf(" if (STATE & simDELAYSLOT)\n");
+ printf(" PC = cia - 4; /* reference the branch instruction */\n");
+ printf(" else\n");
+ printf(" PC = cia;\n");
+ printf(" sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP);\n");
+ printf(" }\n");
+
printf(" SignalException(BreakPoint,instruction);\n");
break ;