diff options
author | Damien George <damien.p.george@gmail.com> | 2014-10-12 16:59:29 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-10-12 16:59:29 +0100 |
commit | 91cfd414c052179ad41755cc7e5085be1a365c2d (patch) | |
tree | 6ca19f158f2df040955b077c801be03e604644fe /py/asmarm.c | |
parent | 1ef2348df0c15f9924d3b5be798fd20805ccd5aa (diff) |
py: Implement native load for viper.
Viper can now do: ptr8(buf)[0], which loads a byte from a buffer using
machine instructions.
Diffstat (limited to 'py/asmarm.c')
-rw-r--r-- | py/asmarm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/py/asmarm.c b/py/asmarm.c index 8d328f2ca..60286d55c 100644 --- a/py/asmarm.c +++ b/py/asmarm.c @@ -357,6 +357,21 @@ void asm_arm_asr_reg_reg(asm_arm_t *as, uint rd, uint rs) { emit_al(as, 0x1a00050 | (rd << 12) | (rs << 8) | rd); } +void asm_arm_ldr_reg_reg(asm_arm_t *as, uint rd, uint rn) { + // ldr rd, [rn] + emit_al(as, 0x5900000 | (rn << 16) | (rd << 12)); +} + +void asm_arm_ldrh_reg_reg(asm_arm_t *as, uint rd, uint rn) { + // ldrh rd, [rn] + emit_al(as, 0x1d000b0 | (rn << 16) | (rd << 12)); +} + +void asm_arm_ldrb_reg_reg(asm_arm_t *as, uint rd, uint rn) { + // ldrb rd, [rn] + emit_al(as, 0x5d00000 | (rn << 16) | (rd << 12)); +} + void asm_arm_str_reg_reg(asm_arm_t *as, uint rd, uint rm) { // str rd, [rm] emit_al(as, 0x5800000 | (rm << 16) | (rd << 12)); |