Skip to content

Commit

Permalink
mips: support reading and writing of hi/lo regs
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot authored and wtdcode committed Nov 7, 2021
1 parent 8732cff commit 7268c2a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions qemu/target/mips/unicorn.c
Expand Up @@ -77,6 +77,12 @@ static void reg_read(CPUMIPSState *env, unsigned int regid, void *value)
switch (regid) {
default:
break;
case UC_MIPS_REG_HI:
*(mipsreg_t *)value = env->active_tc.HI[0];
break;
case UC_MIPS_REG_LO:
*(mipsreg_t *)value = env->active_tc.LO[0];
break;
case UC_MIPS_REG_PC:
*(mipsreg_t *)value = env->active_tc.PC;
break;
Expand All @@ -103,6 +109,12 @@ static void reg_write(CPUMIPSState *env, unsigned int regid, const void *value)
switch (regid) {
default:
break;
case UC_MIPS_REG_HI:
env->active_tc.HI[0] = *(mipsreg_t *)value;
break;
case UC_MIPS_REG_LO:
env->active_tc.LO[0] = *(mipsreg_t *)value;
break;
case UC_MIPS_REG_PC:
env->active_tc.PC = *(mipsreg_t *)value;
break;
Expand Down

0 comments on commit 7268c2a

Please sign in to comment.