[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 23/35] target/mips: Update BadInstr{P} regs on nanoM
From: |
Yongbok Kim |
Subject: |
[Qemu-devel] [PATCH 23/35] target/mips: Update BadInstr{P} regs on nanoMIPS |
Date: |
Wed, 20 Jun 2018 13:06:08 +0100 |
From: Yongbok Kim <address@hidden>
Update BadInstr{P} registers on nanoMIPS
Signed-off-by: Yongbok Kim <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)) {
--
1.9.1
- [Qemu-devel] [PATCH 16/35] target/mips: Add has_isa_mode, (continued)
- [Qemu-devel] [PATCH 16/35] target/mips: Add has_isa_mode, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 17/35] target/mips: Add nanoMIPS load store instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 18/35] target/mips: Add nanoMIPS branch instructions, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 19/35] target/mips: Implement nanoMIPS LLWP/SCWP pair, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 20/35] target/mips: Fix not to update BadVAddr in Debug Mode, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 21/35] target/mips: Add nanoMIPS rotx instruction, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 22/35] target/mips: Fix data type for offset, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 23/35] target/mips: Update BadInstr{P} regs on nanoMIPS,
Yongbok Kim <=
- [Qemu-devel] [PATCH 24/35] target/mips: Add nanoMIPS CP0_BadInstrX register, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 25/35] target/mips: Config3.ISAOnExc is read only in nanoMIPS, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 26/35] target/mips: Fix nanoMIPS exception_resume_pc, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 27/35] target/mips: Fix nanoMIPS set_hflags_for_handler, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 28/35] target/mips: Fix nanoMIPS set_pc, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 29/35] target/mips: Fix ERET/ERETNC can cause ADEL exception, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 30/35] hw/mips: Add basic nanoMIPS boot code, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 31/35] mips_malta: Setup GT64120 BARs in nanoMIPS bootloader, Yongbok Kim, 2018/06/20
- [Qemu-devel] [PATCH 32/35] hw/mips: Fix semihosting argument passing for nanoMIPS bare metal, Yongbok Kim, 2018/06/20