summaryrefslogtreecommitdiff
path: root/py/asmarm.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-12-27 16:13:59 +1100
committerDamien George <damien@micropython.org>2025-01-06 17:55:03 +1100
commit6a90e513dea2267372d8e94f1b83f9260141907d (patch)
tree7b7a9677e4d3e60e62d377bf0c90ad19f804a313 /py/asmarm.c
parent91e30df5f2c9e8c2c84277363a3266d09bc7ae49 (diff)
py/asmarm: Fix asm_arm_ldrh_reg_reg_offset to emit correct machine code.
Prior to this fix, the assembler generated `LDRH Rd, [Rn, #imm]!`, so the second `LDRH` from the same origin would load from the wrong base. Co-authored-by: Alessandro Gatti <a.gatti@frob.it> Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/asmarm.c')
-rw-r--r--py/asmarm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/asmarm.c b/py/asmarm.c
index 600649070..634f2db4f 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -328,7 +328,7 @@ void asm_arm_ldrh_reg_reg(asm_arm_t *as, uint rd, uint rn) {
void asm_arm_ldrh_reg_reg_offset(asm_arm_t *as, uint rd, uint rn, uint byte_offset) {
// ldrh rd, [rn, #off]
- emit_al(as, 0x1f000b0 | (rn << 16) | (rd << 12) | ((byte_offset & 0xf0) << 4) | (byte_offset & 0xf));
+ emit_al(as, 0x1d000b0 | (rn << 16) | (rd << 12) | ((byte_offset & 0xf0) << 4) | (byte_offset & 0xf));
}
void asm_arm_ldrb_reg_reg(asm_arm_t *as, uint rd, uint rn) {