Skip to content

Commit

Permalink
Fix tricore
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Nov 20, 2023
1 parent af8415e commit eea6255
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bindings/python/capstone/tricore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
class TriCoreOpMem(ctypes.Structure):
_fields_ = (
('base', ctypes.c_uint8),
('disp', ctypes.c_int32),
('disp', ctypes.c_int64),
)


class TriCoreOpValue(ctypes.Union):
_fields_ = (
('reg', ctypes.c_uint),
('imm', ctypes.c_int32),
('imm', ctypes.c_int64),
('mem', TriCoreOpMem),
)

Expand Down
7 changes: 3 additions & 4 deletions cstool/cstool_tricore.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <stdio.h>
#include <stdlib.h>

#include <capstone/capstone.h>
#include "cstool.h"
Expand Down Expand Up @@ -30,13 +29,13 @@ void print_insn_detail_tricore(csh handle, cs_insn *ins)
cs_reg_name(handle, op->reg));
break;
case TRICORE_OP_IMM:
printf("\t\toperands[%u].type: IMM = 0x%x\n", i,
op->imm);
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n",
i, op->imm);
break;
case TRICORE_OP_MEM:
printf("\t\toperands[%u].type: MEM\n"
"\t\t\t.mem.base: REG = %s\n"
"\t\t\t.mem.disp: 0x%x\n",
"\t\t\t.mem.disp: 0x%" PRIx64 "\n",
i, cs_reg_name(handle, op->mem.base),
op->mem.disp);
break;
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc110.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
0xc5, 0x00, 0x00, 0x00 = lea a0, #0
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0x7a, 0x00 = lt d15, d0, d0
0xfa, 0x00 = lt d15, d0, #0
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc120.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
0xc5, 0x00, 0x00, 0x00 = lea a0, #0
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0xfd, 0x00, 0x00, 0x80 = loopu #0
0x7a, 0x00 = lt d15, d0, d0
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc130.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
0xc5, 0x00, 0x00, 0x00 = lea a0, #0
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0xfd, 0x00, 0x00, 0x80 = loopu #0
0x7a, 0x00 = lt d15, d0, d0
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc131.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
0xc5, 0x00, 0x00, 0x00 = lea a0, #0
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0xfd, 0x00, 0x00, 0x80 = loopu #0
0x7a, 0x00 = lt d15, d0, d0
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc160.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
0xc5, 0x00, 0x00, 0x00 = lea a0, #0
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0xfd, 0x00, 0x00, 0x80 = loopu #0
0x7a, 0x00 = lt d15, d0, d0
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc161.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
0xc5, 0x00, 0x00, 0x00 = lea a0, #0
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0xfd, 0x00, 0x00, 0x80 = loopu #0
0x7a, 0x00 = lt d15, d0, d0
Expand Down
2 changes: 1 addition & 1 deletion suite/MC/TriCore/tc162.s.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@
0xd9, 0x00, 0x00, 0x00 = lea a0, [a0]#0
0x49, 0x00, 0x00, 0x0a = lea a0, [a0]#0
0xc5, 0x00, 0x00, 0x04 = lha a0, #0
0xfc, 0x00 = loop a0, #-0x20
0xfc, 0x00 = loop a0, #0xffffffe0
0xfd, 0x00, 0x00, 0x00 = loop a0, #0
0xfd, 0x00, 0x00, 0x80 = loopu #0
0x7a, 0x00 = lt d15, d0, d0
Expand Down
9 changes: 5 additions & 4 deletions tests/test_tricore.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ static void print_insn_detail(cs_insn *ins)
cs_reg_name(handle, op->reg));
break;
case TRICORE_OP_IMM:
printf("\t\toperands[%u].type: IMM = 0x%x\n", i,
op->imm);
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n",
i, op->imm);
break;
case TRICORE_OP_MEM:
printf("\t\toperands[%u].type: MEM\n", i);
if (op->mem.base != TRICORE_REG_INVALID)
printf("\t\t\toperands[%u].mem.base: REG = %s\n",
i, cs_reg_name(handle, op->mem.base));
if (op->mem.disp != 0)
printf("\t\t\toperands[%u].mem.disp: 0x%x\n", i,
op->mem.disp);
printf("\t\t\toperands[%u].mem.disp: 0x%" PRIx64
"\n",
i, op->mem.disp);

break;
}
Expand Down

0 comments on commit eea6255

Please sign in to comment.