diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-03-19 22:15:30 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-03-19 22:15:30 +0000 |
commit | 3ad4bb2d3d22f3be94db7bcabac8586cfb222efb (patch) | |
tree | 2dda4e9fb9325deb73cff13cf1f19025660bd2c2 | |
parent | 820e00f252239465e1df507b6fabcffd6b7b6983 (diff) |
Barf on branches/jumps in branch delay slots. Spotted by Stefan Weil.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2513 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | target-mips/translate.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/target-mips/translate.c b/target-mips/translate.c index 6ae3c68ca0..b39ec5f98a 100644 --- a/target-mips/translate.c +++ b/target-mips/translate.c @@ -1368,12 +1368,20 @@ static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) static void gen_compute_branch (DisasContext *ctx, uint32_t opc, int rs, int rt, int32_t offset) { - target_ulong btarget; - int blink, bcond; + target_ulong btarget = -1; + int blink = 0; + int bcond = 0; + + if (ctx->hflags & MIPS_HFLAG_BMASK) { + if (loglevel & CPU_LOG_TB_IN_ASM) { + fprintf(logfile, + "undefined branch in delay slot at pc 0x%08x\n", ctx->pc); + } + MIPS_INVAL("branch/jump in bdelay slot"); + generate_exception(ctx, EXCP_RI); + return; + } - btarget = -1; - blink = 0; - bcond = 0; /* Load needed operands */ switch (opc) { case OPC_BEQ: |