17 #ifdef CAPSTONE_HAS_SPARC
20 #define _CRT_SECURE_NO_WARNINGS
23 #if defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)
24 #pragma warning(disable:28719)
33 #include "../../MCInst.h"
34 #include "../../utils.h"
35 #include "../../SStream.h"
36 #include "../../MCRegisterInfo.h"
37 #include "../../MathExtras.h"
42 static const char *getRegisterName(
unsigned RegNo);
44 static void printMemOperand(
MCInst *MI,
int opNum,
SStream *
O,
const char *Modifier);
47 static void Sparc_add_hint(
MCInst *MI,
unsigned int hint)
54 static void Sparc_add_reg(
MCInst *MI,
unsigned int reg)
73 MI->
flat_insn->detail->sparc.operands[MI->
flat_insn->detail->sparc.op_count].mem.disp = 0;
89 insn->detail->sparc.operands[0].mem.base = (
uint8_t)insn->detail->sparc.operands[0].reg;
90 insn->detail->sparc.operands[0].mem.disp = 0;
94 static void printRegName(
SStream *
OS,
unsigned RegNo)
100 #define GET_INSTRINFO_ENUM
103 #define GET_REGINFO_ENUM
109 default:
return false;
118 default:
return false;
131 printMemOperand(MI, 1,
O,
NULL);
136 printMemOperand(MI, 1,
O,
NULL);
159 printOperand(MI, 1,
O);
161 printOperand(MI, 2,
O);
174 printRegName(
O,
reg);
179 if (MI->
flat_insn->detail->sparc.operands[MI->
flat_insn->detail->sparc.op_count].mem.base)
270 MI->
flat_insn->detail->sparc.operands[MI->
flat_insn->detail->sparc.op_count].mem.disp = Imm;
273 MI->
flat_insn->detail->sparc.operands[MI->
flat_insn->detail->sparc.op_count].imm = Imm;
282 static void printMemOperand(
MCInst *MI,
int opNum,
SStream *
O,
const char *Modifier)
286 set_mem_access(MI,
true);
287 printOperand(MI, opNum,
O);
290 if (Modifier && !strcmp(Modifier,
"arith")) {
292 printOperand(MI, opNum + 1,
O);
293 set_mem_access(MI,
false);
300 set_mem_access(MI,
false);
305 set_mem_access(MI,
false);
311 printOperand(MI, opNum + 1,
O);
312 set_mem_access(MI,
false);
327 case SP_MOVFCCrr:
case SP_V9MOVFCCrr:
328 case SP_MOVFCCri:
case SP_V9MOVFCCri:
329 case SP_FMOVS_FCC:
case SP_V9FMOVS_FCC:
330 case SP_FMOVD_FCC:
case SP_V9FMOVD_FCC:
331 case SP_FMOVQ_FCC:
case SP_V9FMOVQ_FCC:
333 CC = (CC < 16+256) ? (CC + 16) : CC;
350 #define PRINT_ALIAS_INSTR
358 mnem = printAliasInstr(MI,
O, Info);
361 strncpy(instr,
mnem,
sizeof(instr) - 1);
362 instr[
sizeof(instr) - 1] =
'\0';
364 p = strchr(instr,
',');
435 if (!printSparcAliasInstr(MI,
O))
436 printInstruction(MI,
O,
NULL);
unsigned MCInst_getOpcode(const MCInst *inst)
unsigned MCInst_getNumOperands(const MCInst *inst)
MCOperand * MCInst_getOperand(MCInst *inst, unsigned i)
bool MCOperand_isReg(const MCOperand *op)
void MCInst_setOpcodePub(MCInst *inst, unsigned Op)
int64_t MCOperand_getImm(MCOperand *op)
unsigned MCOperand_getReg(const MCOperand *op)
getReg - Returns the register number.
bool MCOperand_isImm(const MCOperand *op)
void printInt64(SStream *O, int64_t val)
void SStream_concat0(SStream *ss, const char *s)
void Sparc_printInst(MCInst *MI, SStream *O, void *Info)
void Sparc_addReg(MCInst *MI, int reg)
void Sparc_post_printer(csh ud, cs_insn *insn, char *insn_asm, MCInst *mci)
sparc_reg Sparc_map_insn(const char *name)
sparc_hint Sparc_map_hint(const char *name)
sparc_cc Sparc_map_FCC(const char *name)
sparc_cc Sparc_map_ICC(const char *name)
sparc_reg Sparc_map_register(unsigned int r)
static const char * SPARCCondCodeToString(sparc_cc CC)
@ CS_MODE_V9
SparcV9 mode (Sparc)
@ CS_OPT_ON
Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).
static const char struct stat static buf struct stat static buf static vhangup int status
@ SPARC_OP_MEM
= CS_OP_MEM (Memory operand).
@ SPARC_OP_IMM
= CS_OP_IMM (Immediate operand).
@ SPARC_OP_REG
= CS_OP_REG (Register operand).
sparc_cc
Enums corresponding to Sparc condition codes, both icc's and fcc's.