Lines Matching refs:op
237 struct opcode op[8]; member
314 #define FOP_START(op) \ argument
315 extern void em_##op(struct fastop *fake); \
317 ".global em_" #op " \n\t" \
319 "em_" #op ": \n\t"
326 #define FOP1E(op, dst) \ argument
327 FOP_ALIGN "10: " #op " %" #dst " \n\t" FOP_RET
329 #define FOP1EEX(op, dst) \ argument
330 FOP1E(op, dst) _ASM_EXTABLE(10b, kvm_fastop_exception)
332 #define FASTOP1(op) \ argument
333 FOP_START(op) \
334 FOP1E(op##b, al) \
335 FOP1E(op##w, ax) \
336 FOP1E(op##l, eax) \
337 ON64(FOP1E(op##q, rax)) \
341 #define FASTOP1SRC2(op, name) \ argument
343 FOP1E(op, cl) \
344 FOP1E(op, cx) \
345 FOP1E(op, ecx) \
346 ON64(FOP1E(op, rcx)) \
350 #define FASTOP1SRC2EX(op, name) \ argument
352 FOP1EEX(op, cl) \
353 FOP1EEX(op, cx) \
354 FOP1EEX(op, ecx) \
355 ON64(FOP1EEX(op, rcx)) \
358 #define FOP2E(op, dst, src) \ argument
359 FOP_ALIGN #op " %" #src ", %" #dst " \n\t" FOP_RET
361 #define FASTOP2(op) \ argument
362 FOP_START(op) \
363 FOP2E(op##b, al, dl) \
364 FOP2E(op##w, ax, dx) \
365 FOP2E(op##l, eax, edx) \
366 ON64(FOP2E(op##q, rax, rdx)) \
370 #define FASTOP2W(op) \ argument
371 FOP_START(op) \
373 FOP2E(op##w, ax, dx) \
374 FOP2E(op##l, eax, edx) \
375 ON64(FOP2E(op##q, rax, rdx)) \
379 #define FASTOP2CL(op) \ argument
380 FOP_START(op) \
381 FOP2E(op##b, al, cl) \
382 FOP2E(op##w, ax, cl) \
383 FOP2E(op##l, eax, cl) \
384 ON64(FOP2E(op##q, rax, cl)) \
388 #define FASTOP2R(op, name) \ argument
390 FOP2E(op##b, dl, al) \
391 FOP2E(op##w, dx, ax) \
392 FOP2E(op##l, edx, eax) \
393 ON64(FOP2E(op##q, rdx, rax)) \
396 #define FOP3E(op, dst, src, src2) \ argument
397 FOP_ALIGN #op " %" #src2 ", %" #src ", %" #dst " \n\t" FOP_RET
400 #define FASTOP3WCL(op) \ argument
401 FOP_START(op) \
403 FOP3E(op##w, ax, dx, cl) \
404 FOP3E(op##l, eax, edx, cl) \
405 ON64(FOP3E(op##q, rax, rdx, cl)) \
409 #define FOP_SETCC(op) ".align 4; " #op " %al; ret \n\t" argument
973 static void fetch_register_operand(struct operand *op) in fetch_register_operand() argument
975 switch (op->bytes) { in fetch_register_operand()
977 op->val = *(u8 *)op->addr.reg; in fetch_register_operand()
980 op->val = *(u16 *)op->addr.reg; in fetch_register_operand()
983 op->val = *(u32 *)op->addr.reg; in fetch_register_operand()
986 op->val = *(u64 *)op->addr.reg; in fetch_register_operand()
1124 struct operand *op) in decode_register_operand() argument
1132 op->type = OP_XMM; in decode_register_operand()
1133 op->bytes = 16; in decode_register_operand()
1134 op->addr.xmm = reg; in decode_register_operand()
1135 read_sse_reg(ctxt, &op->vec_val, reg); in decode_register_operand()
1140 op->type = OP_MM; in decode_register_operand()
1141 op->bytes = 8; in decode_register_operand()
1142 op->addr.mm = reg; in decode_register_operand()
1146 op->type = OP_REG; in decode_register_operand()
1147 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; in decode_register_operand()
1148 op->addr.reg = decode_register(ctxt, reg, ctxt->d & ByteOp); in decode_register_operand()
1150 fetch_register_operand(op); in decode_register_operand()
1151 op->orig_val = op->val; in decode_register_operand()
1161 struct operand *op) in decode_modrm() argument
1178 op->type = OP_REG; in decode_modrm()
1179 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; in decode_modrm()
1180 op->addr.reg = decode_register(ctxt, ctxt->modrm_rm, in decode_modrm()
1183 op->type = OP_XMM; in decode_modrm()
1184 op->bytes = 16; in decode_modrm()
1185 op->addr.xmm = ctxt->modrm_rm; in decode_modrm()
1186 read_sse_reg(ctxt, &op->vec_val, ctxt->modrm_rm); in decode_modrm()
1190 op->type = OP_MM; in decode_modrm()
1191 op->bytes = 8; in decode_modrm()
1192 op->addr.mm = ctxt->modrm_rm & 7; in decode_modrm()
1195 fetch_register_operand(op); in decode_modrm()
1199 op->type = OP_MEM; in decode_modrm()
1289 op->addr.mem.ea = modrm_ea; in decode_modrm()
1298 struct operand *op) in decode_abs() argument
1302 op->type = OP_MEM; in decode_abs()
1305 op->addr.mem.ea = insn_fetch(u16, ctxt); in decode_abs()
1308 op->addr.mem.ea = insn_fetch(u32, ctxt); in decode_abs()
1311 op->addr.mem.ea = insn_fetch(u64, ctxt); in decode_abs()
1708 static void write_register_operand(struct operand *op) in write_register_operand() argument
1710 return assign_register(op->addr.reg, op->val, op->bytes); in write_register_operand()
1713 static int writeback(struct x86_emulate_ctxt *ctxt, struct operand *op) in writeback() argument
1715 switch (op->type) { in writeback()
1717 write_register_operand(op); in writeback()
1722 op->addr.mem, in writeback()
1723 &op->orig_val, in writeback()
1724 &op->val, in writeback()
1725 op->bytes); in writeback()
1728 op->addr.mem, in writeback()
1729 &op->val, in writeback()
1730 op->bytes); in writeback()
1734 op->addr.mem, in writeback()
1735 op->data, in writeback()
1736 op->bytes * op->count); in writeback()
1739 write_sse_reg(ctxt, &op->vec_val, op->addr.xmm); in writeback()
1742 write_mmx_reg(ctxt, &op->mm_val, op->addr.mm); in writeback()
2962 struct operand *op) in string_addr_inc() argument
2964 int df = (ctxt->eflags & X86_EFLAGS_DF) ? -op->count : op->count; in string_addr_inc()
2966 register_address_increment(ctxt, reg, df * op->bytes); in string_addr_inc()
2967 op->addr.mem.ea = register_address(ctxt, reg); in string_addr_inc()
4268 static int decode_imm(struct x86_emulate_ctxt *ctxt, struct operand *op, in decode_imm() argument
4273 op->type = OP_IMM; in decode_imm()
4274 op->bytes = size; in decode_imm()
4275 op->addr.mem.ea = ctxt->_eip; in decode_imm()
4277 switch (op->bytes) { in decode_imm()
4279 op->val = insn_fetch(s8, ctxt); in decode_imm()
4282 op->val = insn_fetch(s16, ctxt); in decode_imm()
4285 op->val = insn_fetch(s32, ctxt); in decode_imm()
4288 op->val = insn_fetch(s64, ctxt); in decode_imm()
4292 switch (op->bytes) { in decode_imm()
4294 op->val &= 0xff; in decode_imm()
4297 op->val &= 0xffff; in decode_imm()
4300 op->val &= 0xffffffff; in decode_imm()
4308 static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, in decode_operand() argument
4315 decode_register_operand(ctxt, op); in decode_operand()
4318 rc = decode_imm(ctxt, op, 1, false); in decode_operand()
4323 *op = ctxt->memop; in decode_operand()
4324 ctxt->memopp = op; in decode_operand()
4327 op->orig_val = op->val; in decode_operand()
4333 op->type = OP_REG; in decode_operand()
4334 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; in decode_operand()
4335 op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RAX); in decode_operand()
4336 fetch_register_operand(op); in decode_operand()
4337 op->orig_val = op->val; in decode_operand()
4340 op->type = OP_REG; in decode_operand()
4341 op->bytes = (ctxt->d & ByteOp) ? 2 : ctxt->op_bytes; in decode_operand()
4342 op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RAX); in decode_operand()
4343 fetch_register_operand(op); in decode_operand()
4344 op->orig_val = op->val; in decode_operand()
4348 op->type = OP_NONE; in decode_operand()
4351 op->type = OP_REG; in decode_operand()
4352 op->bytes = ctxt->op_bytes; in decode_operand()
4353 op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RDX); in decode_operand()
4354 fetch_register_operand(op); in decode_operand()
4355 op->orig_val = op->val; in decode_operand()
4358 op->type = OP_MEM; in decode_operand()
4359 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; in decode_operand()
4360 op->addr.mem.ea = in decode_operand()
4362 op->addr.mem.seg = VCPU_SREG_ES; in decode_operand()
4363 op->val = 0; in decode_operand()
4364 op->count = 1; in decode_operand()
4367 op->type = OP_REG; in decode_operand()
4368 op->bytes = 2; in decode_operand()
4369 op->addr.reg = reg_rmw(ctxt, VCPU_REGS_RDX); in decode_operand()
4370 fetch_register_operand(op); in decode_operand()
4373 op->type = OP_IMM; in decode_operand()
4374 op->bytes = 1; in decode_operand()
4375 op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; in decode_operand()
4378 rc = decode_imm(ctxt, op, 1, true); in decode_operand()
4381 op->type = OP_IMM; in decode_operand()
4382 op->bytes = 1; in decode_operand()
4383 op->val = 1; in decode_operand()
4386 rc = decode_imm(ctxt, op, imm_size(ctxt), true); in decode_operand()
4389 rc = decode_imm(ctxt, op, ctxt->op_bytes, true); in decode_operand()
4406 rc = decode_imm(ctxt, op, 2, false); in decode_operand()
4409 rc = decode_imm(ctxt, op, imm_size(ctxt), false); in decode_operand()
4412 op->type = OP_MEM; in decode_operand()
4413 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; in decode_operand()
4414 op->addr.mem.ea = in decode_operand()
4416 op->addr.mem.seg = ctxt->seg_override; in decode_operand()
4417 op->val = 0; in decode_operand()
4418 op->count = 1; in decode_operand()
4421 op->type = OP_MEM; in decode_operand()
4422 op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes; in decode_operand()
4423 op->addr.mem.ea = in decode_operand()
4427 op->addr.mem.seg = ctxt->seg_override; in decode_operand()
4428 op->val = 0; in decode_operand()
4431 op->type = OP_IMM; in decode_operand()
4432 op->addr.mem.ea = ctxt->_eip; in decode_operand()
4433 op->bytes = ctxt->op_bytes + 2; in decode_operand()
4434 insn_fetch_arr(op->valptr, op->bytes, ctxt); in decode_operand()
4440 op->type = OP_IMM; in decode_operand()
4441 op->val = VCPU_SREG_ES; in decode_operand()
4444 op->type = OP_IMM; in decode_operand()
4445 op->val = VCPU_SREG_CS; in decode_operand()
4448 op->type = OP_IMM; in decode_operand()
4449 op->val = VCPU_SREG_SS; in decode_operand()
4452 op->type = OP_IMM; in decode_operand()
4453 op->val = VCPU_SREG_DS; in decode_operand()
4456 op->type = OP_IMM; in decode_operand()
4457 op->val = VCPU_SREG_FS; in decode_operand()
4460 op->type = OP_IMM; in decode_operand()
4461 op->val = VCPU_SREG_GS; in decode_operand()
4466 op->type = OP_NONE; /* Disable writeback. */ in decode_operand()
4632 opcode = opcode.u.esc->op[(ctxt->modrm >> 3) & 7]; in x86_decode_insn()
4791 struct operand *op) in fetch_possible_mmx_operand() argument
4793 if (op->type == OP_MM) in fetch_possible_mmx_operand()
4794 read_mmx_reg(ctxt, &op->mm_val, op->addr.mm); in fetch_possible_mmx_operand()