[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 24/40] target/mips: Add updating BadInstr and Bad
From: |
Stefan Markovic |
Subject: |
[Qemu-devel] [PATCH v3 24/40] target/mips: Add updating BadInstr and BadInstrP registers for nanoMIPS |
Date: |
Thu, 19 Jul 2018 14:54:56 +0200 |
From: Yongbok Kim <address@hidden>
Updating BadInstr and BadInstrP registers was addded for nanoMIPS.
BadInstr and BadInstrP support for pre-nanoMIPS remains
unimplemented.
Signed-off-by: Yongbok Kim <address@hidden>
Signed-off-by: Aleksandar Markovic <address@hidden>
Signed-off-by: Stefan Markovic <address@hidden>
---
target/mips/helper.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/target/mips/helper.c b/target/mips/helper.c
index e215af9..5299f21 100644
--- a/target/mips/helper.c
+++ b/target/mips/helper.c
@@ -683,7 +683,28 @@ static void set_hflags_for_handler (CPUMIPSState *env)
static inline void set_badinstr_registers(CPUMIPSState *env)
{
if (env->hflags & MIPS_HFLAG_M16) {
- /* TODO: add BadInstr support for microMIPS */
+ uint32_t instr;
+ if (!(env->insn_flags & ISA_NANOMIPS32)) {
+ /* TODO: add BadInstr support for pre-nanoMIPS */
+ return;
+ }
+ if (env->CP0_Config3 & (1 << CP0C3_BI)) {
+ instr = (cpu_lduw_code(env, env->active_tc.PC)) << 16;
+ if ((env->insn_flags & ISA_NANOMIPS32) &&
+ ((instr & 0x10000000) == 0)) {
+ instr |= cpu_lduw_code(env, env->active_tc.PC + 2);
+ }
+ env->CP0_BadInstr = instr;
+ }
+ if ((env->CP0_Config3 & (1 << CP0C3_BP)) &&
+ (env->hflags & MIPS_HFLAG_BMASK)) {
+ if (!(env->hflags & MIPS_HFLAG_B16)) {
+ env->CP0_BadInstrP = cpu_ldl_code(env, env->active_tc.PC - 4);
+ } else {
+ env->CP0_BadInstrP =
+ (cpu_lduw_code(env, env->active_tc.PC - 2)) << 16;
+ }
+ }
return;
}
if (env->CP0_Config3 & (1 << CP0C3_BI)) {
--
2.7.4
- [Qemu-devel] [PATCH v3 00/40] Add nanoMIPS support to QEMU, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 12/40] target/mips: Add emulation of nanoMIPS FP instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 07/40] target/mips: Add emulation of nanoMIPS 16-bit load and store instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 19/40] target/mips: Add emulation of nanoMIPS branch instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 24/40] target/mips: Add updating BadInstr and BadInstrP registers for nanoMIPS,
Stefan Markovic <=
- [Qemu-devel] [PATCH v3 33/40] elf: Relax MIPS' elf_check_arch() to accept EM_NANOMIPS too, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 31/40] target/mips: Fix ERET/ERETNC behavior related to ADEL exception, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 39/40] gdbstub: Add XML support for GDB for nanoMIPS, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 11/40] target/mips: Add emulation of nanoMIPS 48-bit instructions, Stefan Markovic, 2018/07/19
- [Qemu-devel] [PATCH v3 15/40] target/mips: Add emulation of misc nanoMIPS instructions (pool p_lsx), Stefan Markovic, 2018/07/19