diff options
author | Chris Demetriou <cgd@google.com> | 2002-05-01 17:26:14 +0000 |
---|---|---|
committer | Chris Demetriou <cgd@google.com> | 2002-05-01 17:26:14 +0000 |
commit | 402586aa260ba9b74e3a2382276cf31a7abc2b6b (patch) | |
tree | 9d41b87e0d4643c93052427e8966e01a70c9c35a /sim/mips/interp.c | |
parent | a6befae84def7b445a76e360deba6dde20e03052 (diff) | |
download | gdb-402586aa260ba9b74e3a2382276cf31a7abc2b6b.zip gdb-402586aa260ba9b74e3a2382276cf31a7abc2b6b.tar.gz gdb-402586aa260ba9b74e3a2382276cf31a7abc2b6b.tar.bz2 |
2002-05-01 Chris Demetriou <cgd@broadcom.com>
* cp1.c (store_fpr): Remove #ifdef'd out call to UndefinedResult
which wouldn't compile anyway.
* sim-main.h (unpredictable_action): New function prototype.
(Unpredictable): Define to call igen function unpredictable().
(NotWordValue): New macro to call igen function not_word_value().
(UndefinedResult): Remove.
* interp.c (undefined_result): Remove.
(unpredictable_action): New function.
* mips.igen (not_word_value, unpredictable): New functions.
(ADD, ADDI, do_addiu, do_addu, BGEZAL, BGEZALL, BLTZAL, BLTZALL)
(CLO, CLZ, MADD, MADDU, MSUB, MSUBU, MUL, do_mult, do_multu)
(do_sra, do_srav, do_srl, do_srlv, SUB, do_subu): Invoke
NotWordValue() to check for unpredictable inputs, then
Unpredictable() to handle them.
Diffstat (limited to 'sim/mips/interp.c')
-rw-r--r-- | sim/mips/interp.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/sim/mips/interp.c b/sim/mips/interp.c index 5bd61a8..0c587e0 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -1869,28 +1869,31 @@ signal_exception (SIM_DESC sd, -#if defined(WARN_RESULT) -/* Description from page A-26 of the "MIPS IV Instruction Set" manual (revision 3.1) */ -/* This function indicates that the result of the operation is - undefined. However, this should not affect the instruction - stream. All that is meant to happen is that the destination - register is set to an undefined result. To keep the simulator - simple, we just don't bother updating the destination register, so - the overall result will be undefined. If desired we can stop the - simulator by raising a pseudo-exception. */ -#define UndefinedResult() undefined_result (sd,cia) -static void -undefined_result(sd,cia) - SIM_DESC sd; - address_word cia; +/* This function implements what the MIPS32 and MIPS64 ISAs define as + "UNPREDICTABLE" behaviour. + + About UNPREDICTABLE behaviour they say: "UNPREDICTABLE results + may vary from processor implementation to processor implementation, + instruction to instruction, or as a function of time on the same + implementation or instruction. Software can never depend on results + that are UNPREDICTABLE. ..." (MIPS64 Architecture for Programmers + Volume II, The MIPS64 Instruction Set. MIPS Document MD00087 revision + 0.95, page 2.) + + For UNPREDICTABLE behaviour, we print a message, if possible print + the offending instructions mips.igen instruction name (provided by + the caller), and stop the simulator. + + XXX FIXME: eventually, stopping the simulator should be made conditional + on a command-line option. */ +void +unpredictable_action(sim_cpu *cpu, address_word cia) { - sim_io_eprintf(sd,"UndefinedResult: PC = 0x%s\n",pr_addr(cia)); -#if 0 /* Disabled for the moment, since it actually happens a lot at the moment. */ - state |= simSTOP; -#endif - return; + SIM_DESC sd = CPU_STATE(cpu); + + sim_io_eprintf(sd, "UNPREDICTABLE: PC = 0x%s\n", pr_addr (cia)); + sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGABRT); } -#endif /* WARN_RESULT */ /*-- co-processor support routines ------------------------------------------*/ |