aboutsummaryrefslogtreecommitdiff
path: root/py/asmarm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-10-12 14:21:06 +0100
committerDamien George <damien.p.george@gmail.com>2014-10-12 14:21:06 +0100
commit1ef2348df0c15f9924d3b5be798fd20805ccd5aa (patch)
tree4289f7e1d42e55318c96ef44e7e6a499c1ea5a3c /py/asmarm.c
parent1606607bd42ce36f7d892c14b29046b7152d0fa6 (diff)
py: Implement and,or,xor native ops for viper.
Diffstat (limited to 'py/asmarm.c')
-rw-r--r--py/asmarm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/py/asmarm.c b/py/asmarm.c
index 3fac94285..8d328f2ca 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -175,6 +175,21 @@ STATIC uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
return 0x0400000 | (rn << 16) | (rd << 12) | rm;
}
+STATIC uint asm_arm_op_and_reg(uint rd, uint rn, uint rm) {
+ // and rd, rn, rm
+ return 0x0000000 | (rn << 16) | (rd << 12) | rm;
+}
+
+STATIC uint asm_arm_op_eor_reg(uint rd, uint rn, uint rm) {
+ // eor rd, rn, rm
+ return 0x0200000 | (rn << 16) | (rd << 12) | rm;
+}
+
+STATIC uint asm_arm_op_orr_reg(uint rd, uint rn, uint rm) {
+ // orr rd, rn, rm
+ return 0x1800000 | (rn << 16) | (rd << 12) | rm;
+}
+
void asm_arm_bkpt(asm_arm_t *as) {
// bkpt #0
emit_al(as, 0x1200070);
@@ -312,6 +327,21 @@ void asm_arm_sub_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
emit_al(as, asm_arm_op_sub_reg(rd, rn, rm));
}
+void asm_arm_and_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
+ // and rd, rn, rm
+ emit_al(as, asm_arm_op_and_reg(rd, rn, rm));
+}
+
+void asm_arm_eor_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
+ // eor rd, rn, rm
+ emit_al(as, asm_arm_op_eor_reg(rd, rn, rm));
+}
+
+void asm_arm_orr_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
+ // orr rd, rn, rm
+ emit_al(as, asm_arm_op_orr_reg(rd, rn, rm));
+}
+
void asm_arm_mov_reg_local_addr(asm_arm_t *as, uint rd, int local_num) {
// add rd, sp, #local_num*4
emit_al(as, asm_arm_op_add_imm(rd, ASM_ARM_REG_SP, local_num << 2));