summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-25 21:41:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-25 21:41:15 (GMT)
commit7370350b82305afe200c34ed91027a55f543bf98 (patch)
treecddda25dffb1cc17c2a1fb2c194c0564cd17d940
parent62da8564d257af381acb606e98fc712d87f7f5cb (diff)
Fixed some Thumb decodings for ARMv7 branch instructions.
-rw-r--r--plugins/arm/v7/opdefs/A8818_b.d4
-rw-r--r--plugins/arm/v7/opdefs/A8825_bl.d8
-rw-r--r--tools/d2c/args/manager.c23
3 files changed, 30 insertions, 5 deletions
diff --git a/plugins/arm/v7/opdefs/A8818_b.d b/plugins/arm/v7/opdefs/A8818_b.d
index d10b297..e60aad6 100644
--- a/plugins/arm/v7/opdefs/A8818_b.d
+++ b/plugins/arm/v7/opdefs/A8818_b.d
@@ -138,7 +138,9 @@
@conv {
- imm32 = SignExtend(S:J2:J1:imm10:imm11:'0', 32, 24)
+ I1 = NOT(J1 EOR S)
+ I2 = NOT(J2 EOR S)
+ imm32 = SignExtend(S:I1:I2:imm10:imm11:'0', 32, 24)
}
diff --git a/plugins/arm/v7/opdefs/A8825_bl.d b/plugins/arm/v7/opdefs/A8825_bl.d
index 221bbc5..adf3c20 100644
--- a/plugins/arm/v7/opdefs/A8825_bl.d
+++ b/plugins/arm/v7/opdefs/A8825_bl.d
@@ -41,7 +41,9 @@
@conv {
- imm32 = SignExtend(S:J2:J1:imm10:imm11:'0', 32, 24)
+ I1 = NOT(J1 EOR S)
+ I2 = NOT(J2 EOR S)
+ imm32 = SignExtend(S:I1:I2:imm10:imm11:'0', 32, 24)
}
@@ -69,7 +71,9 @@
@conv {
- imm32 = SignExtend(S:J1:J2:imm10H:imm10L:'00', 32, 24)
+ I1 = NOT(J1 EOR S)
+ I2 = NOT(J2 EOR S)
+ imm32 = SignExtend(S:I1:I2:imm10H:imm10L:'00', 32, 24)
}
diff --git a/tools/d2c/args/manager.c b/tools/d2c/args/manager.c
index 8706694..980bc6c 100644
--- a/tools/d2c/args/manager.c
+++ b/tools/d2c/args/manager.c
@@ -1095,14 +1095,33 @@ bool define_arg_expr(const arg_expr_t *expr, int fd, const coding_bits *bits, co
switch (expr->un_op)
{
case CUO_NOT:
- dprintf(fd, "!");
+ dprintf(fd, "(");
break;
default:
result = false;
break;
}
- result &= define_arg_expr(expr->un_expr, fd, bits, list);
+ if (result)
+ result = define_arg_expr(expr->un_expr, fd, bits, list);
+
+ if (result)
+ result = compute_arg_expr_size(expr, bits, list, &max_size);
+
+ if (result)
+ switch (expr->un_op)
+ {
+ case CUO_NOT:
+ dprintf(fd, " ^ ");
+ if (max_size >= 64)
+ dprintf(fd, "0xffffffffffffffff");
+ else
+ dprintf(fd, "0x%x", (1 << max_size) - 1);
+ dprintf(fd, ")");
+ break;
+ default:
+ break;
+ }
break;