diff options
author | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-31 03:47:03 +0000 |
---|---|---|
committer | pbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-03-31 03:47:03 +0000 |
commit | b010980544b543d421b3f514bba3cafc59b3a3db (patch) | |
tree | 695a66970b73a639ef7baf4b820364f04ed81a49 /target-arm/op_helper.c | |
parent | d9ba48308d50ae08e87dc4ea24cb9783b0568c08 (diff) |
ARM TCG conversion 9/16.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4146 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-arm/op_helper.c')
-rw-r--r-- | target-arm/op_helper.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c index d7541d6a65..939aebfe6c 100644 --- a/target-arm/op_helper.c +++ b/target-arm/op_helper.c @@ -459,3 +459,36 @@ void HELPER(cpsr_write)(uint32_t val, uint32_t mask) { cpsr_write(env, val, mask); } + +/* Access to user mode registers from privileged modes. */ +uint32_t HELPER(get_user_reg)(uint32_t regno) +{ + uint32_t val; + + if (regno == 13) { + val = env->banked_r13[0]; + } else if (regno == 14) { + val = env->banked_r14[0]; + } else if (regno >= 8 + && (env->uncached_cpsr & 0x1f) == ARM_CPU_MODE_FIQ) { + val = env->usr_regs[regno - 8]; + } else { + val = env->regs[regno]; + } + return val; +} + +void HELPER(set_user_reg)(uint32_t regno, uint32_t val) +{ + if (regno == 13) { + env->banked_r13[0] = val; + } else if (regno == 14) { + env->banked_r14[0] = val; + } else if (regno >= 8 + && (env->uncached_cpsr & 0x1f) == ARM_CPU_MODE_FIQ) { + env->usr_regs[regno - 8] = val; + } else { + env->regs[regno] = val; + } +} + |