Lines Matching refs:ctxt
57 struct x86_emulate_ctxt ctxt; member
76 static io_emul_stub_t *io_emul_stub_setup(struct priv_op_ctxt *ctxt, u8 opcode, in io_emul_stub_setup() argument
79 if ( !ctxt->io_emul_stub ) in io_emul_stub_setup()
80 ctxt->io_emul_stub = map_domain_page(_mfn(this_cpu(stubs.mfn))) + in io_emul_stub_setup()
86 ctxt->io_emul_stub[0] = 0x48; in io_emul_stub_setup()
87 ctxt->io_emul_stub[1] = 0xb9; in io_emul_stub_setup()
88 *(void **)&ctxt->io_emul_stub[2] = (void *)host_to_guest_gpr_switch; in io_emul_stub_setup()
90 ctxt->io_emul_stub[10] = 0xff; in io_emul_stub_setup()
91 ctxt->io_emul_stub[11] = 0xd1; in io_emul_stub_setup()
93 ctxt->io_emul_stub[12] = (bytes != 2) ? 0x90 : 0x66; in io_emul_stub_setup()
95 ctxt->io_emul_stub[13] = opcode; in io_emul_stub_setup()
97 ctxt->io_emul_stub[14] = !(opcode & 8) ? port : 0x90; in io_emul_stub_setup()
99 ctxt->io_emul_stub[15] = 0xc3; in io_emul_stub_setup()
103 ioemul_handle_quirk(opcode, &ctxt->io_emul_stub[12], ctxt->ctxt.regs); in io_emul_stub_setup()
321 unsigned long *val, struct x86_emulate_ctxt *ctxt) in read_io() argument
323 struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt); in read_io()
328 ASSERT((ctxt->opcode & ~9) == 0xe4); in read_io()
330 if ( !guest_io_okay(port, bytes, curr, ctxt->regs) ) in read_io()
338 io_emul_stub_setup(poc, ctxt->opcode, port, bytes); in read_io()
340 mark_regs_dirty(ctxt->regs); in read_io()
341 io_emul(ctxt->regs); in read_io()
420 unsigned long val, struct x86_emulate_ctxt *ctxt) in write_io() argument
422 struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt); in write_io()
427 ASSERT((ctxt->opcode & ~9) == 0xe6); in write_io()
429 if ( !guest_io_okay(port, bytes, curr, ctxt->regs) ) in write_io()
437 io_emul_stub_setup(poc, ctxt->opcode, port, bytes); in write_io()
439 mark_regs_dirty(ctxt->regs); in write_io()
440 io_emul(ctxt->regs); in write_io()
453 struct x86_emulate_ctxt *ctxt) in read_segment() argument
458 switch ( ctxt->opcode ) in read_segment()
468 if ( ctxt->addr_size < 64 ) in read_segment()
475 case x86_seg_cs: sel = ctxt->regs->cs; break; in read_segment()
480 case x86_seg_ss: sel = ctxt->regs->ss; break; in read_segment()
532 guest_kernel_mode(current, ctxt->regs) ) in read_segment()
541 struct x86_emulate_ctxt *ctxt, in pv_emul_virt_to_linear() argument
548 if ( ctxt->addr_size < 64 ) in pv_emul_virt_to_linear()
560 0, ctxt); in pv_emul_virt_to_linear()
568 struct x86_emulate_ctxt *ctxt) in rep_ins() argument
570 struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt); in rep_ins()
581 if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) ) in rep_ins()
584 rc = read_segment(x86_seg_es, &sreg, ctxt); in rep_ins()
594 x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt); in rep_ins()
606 sreg.limit, x86_seg_es, ctxt, &addr); in rep_ins()
613 addr + bytes_per_rep - rc, ctxt); in rep_ins()
623 if ( unlikely(ctxt->regs->eflags & X86_EFLAGS_DF) ) in rep_ins()
635 struct x86_emulate_ctxt *ctxt) in rep_outs() argument
637 struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt); in rep_outs()
646 if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) ) in rep_outs()
649 rc = read_segment(seg, &sreg, ctxt); in rep_outs()
661 0, ctxt); in rep_outs()
673 sreg.limit, seg, ctxt, &addr); in rep_outs()
679 x86_emul_pagefault(0, addr + bytes_per_rep - rc, ctxt); in rep_outs()
691 if ( unlikely(ctxt->regs->eflags & X86_EFLAGS_DF) ) in rep_outs()
701 struct x86_emulate_ctxt *ctxt) in read_cr() argument
745 struct x86_emulate_ctxt *ctxt) in write_cr() argument
802 struct x86_emulate_ctxt *ctxt) in read_dr() argument
815 struct x86_emulate_ctxt *ctxt) in write_dr() argument
838 struct x86_emulate_ctxt *ctxt) in read_msr() argument
840 struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt); in read_msr()
849 x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt); in read_msr()
993 struct x86_emulate_ctxt *ctxt) in write_msr() argument
1003 x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt); in write_msr()
1193 static int _wbinvd(struct x86_emulate_ctxt *ctxt) in _wbinvd() argument
1209 struct cpuid_leaf *res, struct x86_emulate_ctxt *ctxt) in pv_emul_cpuid() argument
1217 struct x86_emulate_ctxt *ctxt) in validate() argument
1219 switch ( ctxt->opcode ) in validate()
1235 if ( !iopl_ok(current, ctxt->regs) ) in validate()
1270 struct x86_emulate_ctxt *ctxt) in insn_fetch() argument
1273 container_of(ctxt, struct priv_op_ctxt, ctxt); in insn_fetch()
1284 x86_seg_cs, ctxt, &addr); in insn_fetch()
1295 x86_emul_pagefault(0, addr + bytes - rc, ctxt); in insn_fetch()
1326 struct priv_op_ctxt ctxt = { in pv_emulate_privileged_op() local
1327 .ctxt.regs = regs, in pv_emulate_privileged_op()
1328 .ctxt.vendor = currd->arch.cpuid->x86_vendor, in pv_emulate_privileged_op()
1329 .ctxt.lma = !is_pv_32bit_domain(currd), in pv_emulate_privileged_op()
1334 if ( !pv_emul_read_descriptor(regs->cs, curr, &ctxt.cs.base, in pv_emulate_privileged_op()
1335 &ctxt.cs.limit, &ar, 1) || in pv_emulate_privileged_op()
1351 ctxt.ctxt.addr_size = ar & _SEGMENT_L ? 64 : ar & _SEGMENT_DB ? 32 : 16; in pv_emulate_privileged_op()
1353 rc = x86_emulate(&ctxt.ctxt, &priv_op_ops); in pv_emulate_privileged_op()
1355 if ( ctxt.io_emul_stub ) in pv_emulate_privileged_op()
1356 unmap_domain_page(ctxt.io_emul_stub); in pv_emulate_privileged_op()
1371 if ( ctxt.tsc & TSC_BASE ) in pv_emulate_privileged_op()
1373 if ( ctxt.tsc & TSC_AUX ) in pv_emulate_privileged_op()
1381 if ( ctxt.ctxt.retire.singlestep ) in pv_emulate_privileged_op()
1382 ctxt.bpmatch |= DR_STEP; in pv_emulate_privileged_op()
1383 if ( ctxt.bpmatch ) in pv_emulate_privileged_op()
1385 curr->arch.debugreg[6] |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE; in pv_emulate_privileged_op()
1394 pv_inject_event(&ctxt.ctxt.event); in pv_emulate_privileged_op()