aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/arm/dyncom/arm_dyncom_thumb.h
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-07-28 09:58:42 -0400
committerGravatar bunnei <bunneidev@gmail.com>2015-07-28 09:58:42 -0400
commitfe15cf00196da4684a5513425709c508416918c9 (patch)
treed6a0f969c8a61cf16a6df2a968b83b0549d35b79 /src/core/arm/dyncom/arm_dyncom_thumb.h
parent62adb4ee7b69449aa2c9ac2a519b49b9d54f15fe (diff)
parent9be4ef3879765943b67f623eb1aaa247cb3630b6 (diff)
Merge pull request #1003 from lioncash/armcruft
dyncom: Minor cleanups.
Diffstat (limited to 'src/core/arm/dyncom/arm_dyncom_thumb.h')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_thumb.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.h b/src/core/arm/dyncom/arm_dyncom_thumb.h
index c06f0958..44797436 100644
--- a/src/core/arm/dyncom/arm_dyncom_thumb.h
+++ b/src/core/arm/dyncom/arm_dyncom_thumb.h
@@ -28,20 +28,22 @@
#include "common/common_types.h"
-enum tdstate {
- t_undefined, // Undefined Thumb instruction
- t_decoded, // Instruction decoded to ARM equivalent
- t_branch, // Thumb branch (already processed)
- t_uninitialized,
+enum class ThumbDecodeStatus {
+ UNDEFINED, // Undefined Thumb instruction
+ DECODED, // Instruction decoded to ARM equivalent
+ BRANCH, // Thumb branch (already processed)
+ UNINITIALIZED,
};
-tdstate thumb_translate(u32 addr, u32 instr, u32* ainstr, u32* inst_size);
+// Translates a Thumb mode instruction into its ARM equivalent.
+ThumbDecodeStatus TranslateThumbInstruction(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;
}