aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/arm/dyncom/arm_dyncom_run.h
diff options
context:
space:
mode:
authorGravatar Lioncash <mathew1800@gmail.com>2015-04-07 08:00:07 -0400
committerGravatar Lioncash <mathew1800@gmail.com>2015-04-07 08:05:41 -0400
commita6c9e453b24ba5372eab56bed1ce9abdad2177a1 (patch)
tree50b40e0cae1b0ccfefd0ea942f4eeb2566388569 /src/core/arm/dyncom/arm_dyncom_run.h
parent11bd6024fb2d09b11df3ef12f7188a5b3be5c577 (diff)
dyncom: Remove unnecessary enum and typedef
Also fixes descriptions in the process.
Diffstat (limited to 'src/core/arm/dyncom/arm_dyncom_run.h')
-rw-r--r--src/core/arm/dyncom/arm_dyncom_run.h41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/core/arm/dyncom/arm_dyncom_run.h b/src/core/arm/dyncom/arm_dyncom_run.h
index e1742049..85774c56 100644
--- a/src/core/arm/dyncom/arm_dyncom_run.h
+++ b/src/core/arm/dyncom/arm_dyncom_run.h
@@ -22,31 +22,36 @@
void switch_mode(ARMul_State* core, uint32_t mode);
-/* FIXME, we temporarily think thumb instruction is always 16 bit */
+// Note that for the 3DS, a Thumb instruction will only ever be
+// two bytes in size. Thus we don't need to worry about ThumbEE
+// or Thumb-2 where instructions can be 4 bytes in length.
static inline u32 GET_INST_SIZE(ARMul_State* core) {
return core->TFlag? 2 : 4;
}
/**
-* @brief Read R15 and forced R15 to wold align, used address calculation
-*
-* @param core
-* @param Rn
-*
-* @return
-*/
-static inline addr_t CHECK_READ_REG15_WA(ARMul_State* core, int Rn) {
- return (Rn == 15)? ((core->Reg[15] & ~0x3) + GET_INST_SIZE(core) * 2) : core->Reg[Rn];
+ * Checks if the PC is being read, and if so, word-aligns it.
+ * Used with address calculations.
+ *
+ * @param core The ARM CPU state instance.
+ * @param Rn The register being read.
+ *
+ * @return If the PC is being read, then the word-aligned PC value is returned.
+ * If the PC is not being read, then the value stored in the register is returned.
+ */
+static inline u32 CHECK_READ_REG15_WA(ARMul_State* core, int Rn) {
+ return (Rn == 15) ? ((core->Reg[15] & ~0x3) + GET_INST_SIZE(core) * 2) : core->Reg[Rn];
}
/**
-* @brief Read R15, used to data processing with pc
-*
-* @param core
-* @param Rn
-*
-* @return
-*/
+ * Reads the PC. Used for data processing operations that use the PC.
+ *
+ * @param core The ARM CPU state instance.
+ * @param Rn The register being read.
+ *
+ * @return If the PC is being read, then the incremented PC value is returned.
+ * If the PC is not being read, then the values stored in the register is returned.
+ */
static inline u32 CHECK_READ_REG15(ARMul_State* core, int Rn) {
- return (Rn == 15)? ((core->Reg[15] & ~0x1) + GET_INST_SIZE(core) * 2) : core->Reg[Rn];
+ return (Rn == 15) ? ((core->Reg[15] & ~0x1) + GET_INST_SIZE(core) * 2) : core->Reg[Rn];
}