unicorn/qemu/target-mips
Leon Alrae 6cd0c5d775
target-mips: fix hflags modified in delay / forbidden slot
All instructions which may change hflags terminate tb. However, this doesn't
work if such an instruction is placed in delay or forbidden slot.
gen_branch() clears MIPS_HFLAG_BMASK in ctx->hflags and then generates code
to overwrite hflags with ctx->hflags, consequently we loose any execution-time
hflags modifications. For example, in the following scenario hflag related to
Status.CU1 will not be updated:
/* Set Status.CU1 in delay slot */
mfc0 $24, $12, 0
lui $25, 0x2000
or $25, $25, $24
b check_Status_CU1
mtc0 $25, $12, 0

With this change we clear MIPS_HFLAG_BMASK in execution-time hflags if
instruction in delay or forbidden slot wants to terminate tb for some reason
(i.e. ctx->bstate != BS_NONE).

Also, die early and loudly if "unknown branch" is encountered as this should
never happen.

Backports commit a5f533909e746ca6e534b232fb42c9c6fd81b468 from qemu
2018-02-12 16:29:40 -05:00
..
cpu-qom.h remove slow cpu QOM casts (#815) 2017-05-02 14:56:39 +08:00
cpu.c Fix for MIPS issue. (#733) 2017-01-23 12:39:34 +08:00
cpu.h target-mips: add missing MSACSR and restore fp_status and hflags 2018-02-12 16:12:17 -05:00
dsp_helper.c Added MIPS support and projects for all samples. 2017-01-23 01:05:08 +11:00
helper.c target-mips: remove excp_names[] from linux-user as it is unused 2018-02-11 17:05:40 -05:00
helper.h target-mips: Fix CP0.Config3.ISAOnExc write accesses 2018-02-11 16:24:19 -05:00
lmi_helper.c import 2015-08-21 15:04:50 +08:00
Makefile.objs import 2015-08-21 15:04:50 +08:00
mips-defs.h import 2015-08-21 15:04:50 +08:00
msa_helper.c target-mips: add missing MSACSR and restore fp_status and hflags 2018-02-12 16:12:17 -05:00
op_helper.c target-mips: ll and lld cause AdEL exception for unaligned address 2018-02-11 17:14:43 -05:00
TODO import 2015-08-21 15:04:50 +08:00
translate.c target-mips: fix hflags modified in delay / forbidden slot 2018-02-12 16:29:40 -05:00
translate_init.c target-mips: add missing MSACSR and restore fp_status and hflags 2018-02-12 16:12:17 -05:00
unicorn.c Merge branch 'master' into msvc2 2017-04-21 01:17:00 +08:00
unicorn.h armeb: rename arm's and mips's *REGS_STORAGE_SIZE to avoid big-endian and little-endian's duplicated definition. 2017-03-15 22:25:35 +08:00