From 1e688d4ff9a814f58513f10f05aebfb405133ec7 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Wed, 18 Jun 2014 14:28:55 +0800 Subject: [PATCH] x86: do not use markup in AT&T syntax --- arch/X86/X86ATTInstPrinter.c | 40 +++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c index 794f0240..72442f5c 100644 --- a/arch/X86/X86ATTInstPrinter.c +++ b/arch/X86/X86ATTInstPrinter.c @@ -30,8 +30,6 @@ #include "../../MCRegisterInfo.h" #include "X86Mapping.h" -#define markup(x) "" - #define GET_INSTRINFO_ENUM #ifdef CAPSTONE_X86_REDUCE @@ -228,8 +226,6 @@ static void printSrcIdx(MCInst *MI, unsigned Op, SStream *O) SegReg = MCInst_getOperand(MI, Op+1); - SStream_concat0(O, markup("")); + SStream_concat0(O, ")"); set_mem_access(MI, false); } @@ -249,14 +245,14 @@ static void printDstIdx(MCInst *MI, unsigned Op, SStream *O) { // DI accesses are always ES-based on non-64bit mode if (MI->csh->mode != CS_MODE_64) - SStream_concat(O, "%s%s", markup("")); + SStream_concat0(O, ")"); set_mem_access(MI, false); } @@ -313,8 +309,6 @@ static void printMemOffset(MCInst *MI, unsigned Op, SStream *O) MCOperand *DispSpec = MCInst_getOperand(MI, Op); MCOperand *SegReg = MCInst_getOperand(MI, Op+1); - SStream_concat0(O, markup("")); - if (MI->csh->detail) MI->flat_insn->detail->x86.op_count++; } @@ -435,14 +427,14 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O) int64_t imm = MCOperand_getImm(Op); if (imm >= 0) { if (imm > HEX_THRESHOLD) - SStream_concat(O, "%s$0x%"PRIx64"%s", markup("")); + SStream_concat(O, "$0x%"PRIx64, imm); else - SStream_concat(O, "%s$%"PRIu64"%s", markup("")); + SStream_concat(O, "$%"PRIu64, imm); } else { if (imm < -HEX_THRESHOLD) - SStream_concat(O, "%s$-0x%"PRIx64"%s", markup("")); + SStream_concat(O, "$-0x%"PRIx64, -imm); else - SStream_concat(O, "%s$-%"PRIu64"%s", markup("")); + SStream_concat(O, "$-%"PRIu64, -imm); } if (MI->csh->detail) { if (MI->csh->doing_mem) { @@ -473,14 +465,14 @@ static void _printOperand(MCInst *MI, unsigned OpNo, SStream *O) int64_t imm = MCOperand_getImm(Op); if (imm < 0) { if (imm < -HEX_THRESHOLD) - SStream_concat(O, "%s$-0x%"PRIx64"%s", markup("")); + SStream_concat(O, "$-0x%"PRIx64, -imm); else - SStream_concat(O, "%s$-%"PRIu64"%s", markup("")); + SStream_concat(O, "$-%"PRIu64, -imm); } else { if (imm > HEX_THRESHOLD) - SStream_concat(O, "%s$0x%"PRIx64"%s", markup("")); + SStream_concat(O, "$0x%"PRIx64, imm); else - SStream_concat(O, "%s$%"PRIu64"%s", markup("")); + SStream_concat(O, "$%"PRIu64, imm); } } } @@ -502,8 +494,6 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O) MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.disp = 0; } - SStream_concat0(O, markup("csh->detail) MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.scale = (int)ScaleVal; if (ScaleVal != 1) { - SStream_concat(O, ", %s%u%s", markup("")); + SStream_concat(O, ", %u", ScaleVal); } } SStream_concat0(O, ")"); } - SStream_concat0(O, markup(">")); - if (MI->csh->detail) MI->flat_insn->detail->x86.op_count++; } @@ -566,7 +554,7 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O) static void printRegName(SStream *OS, unsigned RegNo) { - SStream_concat(OS, "%s%%%s%s", markup("")); + SStream_concat(OS, "%%%s", getRegisterName(RegNo)); } void X86_ATT_printInst(MCInst *MI, SStream *OS, void *info)