Definition at line 12 of file TestX86.java.
◆ array2hex()
static String TestX86.array2hex |
( |
byte[] |
arr | ) |
|
|
inlinestaticprivate |
◆ hex() [1/2]
◆ hex() [2/2]
Definition at line 35 of file TestX86.java.
36 return Long.toString(
i, 16);
References i.
◆ hexString2Byte()
static byte [] TestX86.hexString2Byte |
( |
String |
s | ) |
|
|
inlinestaticpackage |
Definition at line 14 of file TestX86.java.
17 byte[] data =
new byte[
len / 2];
18 for (
int i = 0;
i <
len;
i += 2) {
19 data[
i / 2] = (byte) ((Character.digit(
s.charAt(
i), 16) << 4)
20 + Character.digit(
s.charAt(
i+1), 16));
References i, len, and s.
Referenced by main().
◆ main()
static void TestX86.main |
( |
String |
argv[] | ) |
|
|
inlinestatic |
Definition at line 192 of file TestX86.java.
203 System.out.println(
new String(
new char[16]).
replace(
"\0",
"*"));
204 System.out.println(
"Platform: " +
test.comment);
206 System.out.println(
"Disasm:");
209 cs.setDetail(Capstone.CS_OPT_ON);
210 if (
test.syntax != 0) {
211 cs.setSyntax(
test.syntax);
213 Capstone.CsInsn[] all_ins =
cs.disasm(
test.code, 0x1000);
215 for (
int j = 0; j < all_ins.length; j++) {
217 System.out.println();
220 System.out.printf(
"0x%x:\n\n", all_ins[all_ins.length-1].address + all_ins[all_ins.length-1].size);
static String stringToHex(byte[] code)
static byte[] hexString2Byte(String s)
static final String X86_CODE64
static void print_ins_detail(Capstone.CsInsn ins)
static final String X86_CODE32
static final String X86_CODE16
int replace(char *string, const char *token, const char *fmt,...)
References test_arm.all_tests, cs, hexString2Byte(), i, print_ins_detail(), replace(), TestBasic.stringToHex(), X86_CODE16, X86_CODE32, and X86_CODE64.
◆ print_ins_detail()
static void TestX86.print_ins_detail |
( |
Capstone.CsInsn |
ins | ) |
|
|
inlinestatic |
Definition at line 46 of file TestX86.java.
47 System.out.printf(
"0x%x:\t%s\t%s\n", ins.address, ins.mnemonic, ins.opStr);
56 System.out.printf(
"\trex: 0x%x\n",
operands.rex);
59 System.out.printf(
"\taddr_size: %d\n",
operands.addrSize);
62 System.out.printf(
"\tmodrm: 0x%x\n",
operands.modrm);
65 if (
operands.encoding.modrmOffset != 0) {
66 System.out.printf(
"\tmodrm offset: 0x%x\n",
operands.encoding.modrmOffset);
70 System.out.printf(
"\tdisp: 0x%x\n",
operands.disp);
73 if (
operands.encoding.dispOffset != 0) {
74 System.out.printf(
"\tdisp offset: 0x%x\n",
operands.encoding.dispOffset);
78 if (
operands.encoding.dispSize != 0) {
79 System.out.printf(
"\tdisp size: 0x%x\n",
operands.encoding.dispSize);
83 if ( (
cs.mode & Capstone.CS_MODE_16) == 0) {
85 System.out.printf(
"\tsib: 0x%x\n",
operands.sib);
87 System.out.printf(
"\t\tsib_base: %s\n\t\tsib_index: %s\n\t\tsib_scale: %d\n",
92 System.out.printf(
"\txop_cc: %u\n",
operands.xopCC);
95 System.out.printf(
"\tsse_cc: %u\n",
operands.sseCC);
98 System.out.printf(
"\tavx_cc: %u\n",
operands.avxCC);
101 System.out.printf(
"\tavx_sae: TRUE\n");
104 System.out.printf(
"\tavx_rm: %u\n",
operands.avxRm);
108 System.out.printf(
"\timm_count: %d\n",
count);
109 System.out.printf(
"\timm offset: 0x%x\n",
operands.encoding.immOffset);
110 System.out.printf(
"\timm size: 0x%x\n",
operands.encoding.immSize);
113 System.out.printf(
"\t\timms[%d]: 0x%x\n",
i+1, (
operands.op[index].value.imm));
118 System.out.printf(
"\top_count: %d\n",
operands.op.length);
123 System.out.printf(
"\t\toperands[%d].type: REG = %s\n",
c, ins.regName(
i.value.reg));
125 System.out.printf(
"\t\toperands[%d].type: IMM = 0x%x\n",
c,
i.value.imm);
127 System.out.printf(
"\t\toperands[%d].type: MEM\n",
c);
128 String segment = ins.regName(
i.value.mem.segment);
129 String base = ins.regName(
i.value.mem.base);
130 String index = ins.regName(
i.value.mem.index);
132 System.out.printf(
"\t\t\toperands[%d].mem.segment: REG = %s\n",
c, segment);
134 System.out.printf(
"\t\t\toperands[%d].mem.base: REG = %s\n",
c, base);
136 System.out.printf(
"\t\t\toperands[%d].mem.index: REG = %s\n",
c, index);
137 if (
i.value.mem.scale != 1)
138 System.out.printf(
"\t\t\toperands[%d].mem.scale: %d\n",
c,
i.value.mem.scale);
139 if (
i.value.mem.disp != 0)
140 System.out.printf(
"\t\t\toperands[%d].mem.disp: 0x%x\n",
c,
i.value.mem.disp);
145 System.out.printf(
"\t\toperands[%d].avx_bcast: %d\n",
c,
i.avx_bcast);
149 if (
i.avx_zero_opmask) {
150 System.out.printf(
"\t\toperands[%d].avx_zero_opmask: TRUE\n",
c);
153 System.out.printf(
"\t\toperands[%d].size: %d\n",
c,
i.size);
156 System.out.printf(
"\t\toperands[%d].access: READ\n",
c);
159 System.out.printf(
"\t\toperands[%d].access: WRITE\n",
c);
162 System.out.printf(
"\t\toperands[%d].access: READ | WRITE\n",
c);
168 CsRegsAccess regsAccess = ins.regsAccess();
169 if (regsAccess !=
null) {
170 short[] regsRead = regsAccess.regsRead;
171 short[] regsWrite = regsAccess.regsWrite;
173 if (regsRead.length > 0) {
174 System.out.printf(
"\tRegisters read:");
175 for (
int i = 0;
i < regsRead.length;
i++) {
176 System.out.printf(
" %s", ins.regName(regsRead[
i]));
178 System.out.print(
"\n");
181 if (regsWrite.length > 0) {
182 System.out.printf(
"\tRegister modified:");
183 for (
int i = 0;
i < regsWrite.length;
i++) {
184 System.out.printf(
" %s", ins.regName(regsWrite[
i]));
186 System.out.print(
"\n");
@ CS_AC_READ
Operand read from memory or register.
@ CS_AC_WRITE
Operand write to memory or register.
@ X86_AVX_BCAST_INVALID
Uninitialized.
@ X86_OP_IMM
= CS_OP_IMM (Immediate operand).
@ X86_OP_REG
= CS_OP_REG (Register operand).
@ X86_OP_MEM
= CS_OP_MEM (Memory operand).
static String array2hex(byte[] arr)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
References array2hex(), c, count, cs, CS_AC_READ, CS_AC_WRITE, hex(), i, imm, X86_AVX_BCAST_INVALID, X86_OP_IMM, X86_OP_MEM, and X86_OP_REG.
Referenced by main().
◆ cs
◆ X86_CODE16
final String TestX86.X86_CODE16 = "8d4c320801d881c6341200000523010000368b849123010000418d8439896700008d8789670000b4c6" |
|
staticpackage |
◆ X86_CODE32
final String TestX86.X86_CODE32 = "8d4c320801d881c6341200000523010000368b849123010000418d8439896700008d8789670000b4c6" |
|
staticpackage |
◆ X86_CODE64
The documentation for this class was generated from the following file: