summaryrefslogtreecommitdiff
path: root/arm
diff options
context:
space:
mode:
authorneonloop2021-07-03 20:17:38 +0000
committerneonloop2021-07-03 20:17:38 +0000
commit0398338eac60a820bd636c23af34fa76f047681a (patch)
tree2180bd5c52f600b3e98ca352aedbf230fe44fa27 /arm
parent2815c248d76932787fb58d5bbaa0f26be7bcb2be (diff)
downloadpicogpsp-0398338eac60a820bd636c23af34fa76f047681a.tar.gz
picogpsp-0398338eac60a820bd636c23af34fa76f047681a.tar.bz2
picogpsp-0398338eac60a820bd636c23af34fa76f047681a.zip
Restores extract/extend functions for old ARM devices
Diffstat (limited to 'arm')
-rw-r--r--arm/arm_stub.S29
1 files changed, 23 insertions, 6 deletions
diff --git a/arm/arm_stub.S b/arm/arm_stub.S
index 848d311..4d7e22b 100644
--- a/arm/arm_stub.S
+++ b/arm/arm_stub.S
@@ -67,8 +67,14 @@ _##symbol:
#define MODE_SUPERVISOR 3
-#define extract_u16(rd, rs) \
- uxth rd, rs
+#if __ARM_ARCH >= 6
+ #define extract_u16(rd, rs) \
+ uxth rd, rs
+#else
+ #define extract_u16(rd, rs) \
+ bic rd, rs, #0xff000000 ;\
+ bic rd, rd, #0x00ff0000
+#endif
@ Will load the register set from memory into the appropriate cached registers.
@ See arm_emit.h for listing explanation.
@@ -772,11 +778,22 @@ lookup_pc:
#define sign_extend_u16(reg)
#define sign_extend_u32(reg)
-#define sign_extend_s8(reg) ;\
- sxtb reg, reg
+#if __ARM_ARCH >= 6
+ #define sign_extend_s8(reg) ;\
+ sxtb reg, reg
+
+ #define sign_extend_s16(reg) ;\
+ sxth reg, reg
+#else
+ #define sign_extend_s8(reg) ;\
+ mov reg, reg, lsl #24 /* shift reg into upper 8bits */;\
+ mov reg, reg, asr #24 /* shift down, sign extending */;\
+
+ #define sign_extend_s16(reg) ;\
+ mov reg, reg, lsl #16 /* shift reg into upper 16bits */;\
+ mov reg, reg, asr #16 /* shift down, sign extending */;\
-#define sign_extend_s16(reg) ;\
- sxth reg, reg
+#endif
#define execute_load_op_u8(load_op) ;\
mov r0, r0, lsl #17 ;\