diff options
author | Lioncash <mathew1800@gmail.com> | 2015-07-27 22:22:00 -0400 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2015-07-27 22:22:00 -0400 |
commit | 7e4fb4db193433c77ffd707b62d11e58e46c684e (patch) | |
tree | d0e9acb6e566d23e133bea77c5026f7aeb06e2c8 /src/core/arm/dyncom/arm_dyncom_thumb.h | |
parent | a507ea23c157abfc490cbb0c85154b23c4b079b9 (diff) |
dyncom: Remove code duplication regarding thumb instructions
Diffstat (limited to 'src/core/arm/dyncom/arm_dyncom_thumb.h')
-rw-r--r-- | src/core/arm/dyncom/arm_dyncom_thumb.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.h b/src/core/arm/dyncom/arm_dyncom_thumb.h index c06f0958..74e69e13 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.h +++ b/src/core/arm/dyncom/arm_dyncom_thumb.h @@ -37,11 +37,12 @@ enum tdstate { tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size); -static inline u32 get_thumb_instr(u32 instr, u32 pc) { - u32 tinstr; - if ((pc & 0x3) != 0) - tinstr = instr >> 16; - else - tinstr = instr & 0xFFFF; - return tinstr; +static inline u32 GetThumbInstruction(u32 instr, u32 address) { + // Normally you would need to handle instruction endianness, + // however, it is fixed to little-endian on the MPCore, so + // there's no need to check for this beforehand. + if ((address & 0x3) != 0) + return instr >> 16; + + return instr & 0xFFFF; } |