Lines Matching refs:ctxt

184 static enum es_result vc_init_em_ctxt(struct es_em_ctxt *ctxt,
190 memset(ctxt, 0, sizeof(*ctxt));
191 ctxt->regs = regs;
194 ret = vc_decode_insn(ctxt);
199 static void vc_finish_insn(struct es_em_ctxt *ctxt)
201 ctxt->regs->ip += ctxt->insn.length;
204 static enum es_result verify_exception_info(struct ghcb *ghcb, struct es_em_ctxt *ctxt)
220 ctxt->fi.vector = v;
223 ctxt->fi.error_code = info >> 32;
233 struct es_em_ctxt *ctxt,
248 return verify_exception_info(ghcb, ctxt);
289 static int __sev_cpuid_hv_ghcb(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
304 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0);
322 static int sev_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
324 return ghcb ? __sev_cpuid_hv_ghcb(ghcb, ctxt, leaf)
431 static void snp_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
433 if (sev_cpuid_hv(ghcb, ctxt, leaf))
437 static int snp_cpuid_postprocess(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
444 snp_cpuid_hv(ghcb, ctxt, &leaf_hv);
463 snp_cpuid_hv(ghcb, ctxt, &leaf_hv);
511 snp_cpuid_hv(ghcb, ctxt, &leaf_hv);
533 snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
567 return snp_cpuid_postprocess(ghcb, ctxt, leaf);
642 static enum es_result vc_insn_string_check(struct es_em_ctxt *ctxt,
646 if (user_mode(ctxt->regs) && fault_in_kernel_space(address)) {
647 ctxt->fi.vector = X86_TRAP_PF;
648 ctxt->fi.error_code = X86_PF_USER;
649 ctxt->fi.cr2 = address;
651 ctxt->fi.error_code |= X86_PF_WRITE;
659 static enum es_result vc_insn_string_read(struct es_em_ctxt *ctxt,
669 ret = vc_insn_string_check(ctxt, address, false);
677 ret = vc_read_mem(ctxt, s, d, data_size);
685 static enum es_result vc_insn_string_write(struct es_em_ctxt *ctxt,
695 ret = vc_insn_string_check(ctxt, address, true);
703 ret = vc_write_mem(ctxt, d, b, data_size);
730 static enum es_result vc_ioio_exitinfo(struct es_em_ctxt *ctxt, u64 *exitinfo)
732 struct insn *insn = &ctxt->insn;
744 port = ctxt->regs->dx & 0xffff;
752 port = ctxt->regs->dx & 0xffff;
773 port = ctxt->regs->dx & 0xffff;
780 port = ctxt->regs->dx & 0xffff;
822 return vc_ioio_check(ctxt, (u16)port, size);
825 static enum es_result vc_handle_ioio(struct ghcb *ghcb, struct es_em_ctxt *ctxt)
827 struct pt_regs *regs = ctxt->regs;
831 ret = vc_ioio_exitinfo(ctxt, &exit_info_1);
858 es_base = insn_get_seg_base(ctxt->regs, INAT_SEG_REG_ES);
862 ret = vc_insn_string_read(ctxt,
877 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO,
884 ret = vc_insn_string_write(ctxt,
919 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_IOIO, exit_info_1, 0);
933 static int vc_handle_cpuid_snp(struct ghcb *ghcb, struct es_em_ctxt *ctxt)
935 struct pt_regs *regs = ctxt->regs;
941 ret = snp_cpuid(ghcb, ctxt, &leaf);
953 struct es_em_ctxt *ctxt)
955 struct pt_regs *regs = ctxt->regs;
960 snp_cpuid_ret = vc_handle_cpuid_snp(ghcb, ctxt);
976 ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0);
995 struct es_em_ctxt *ctxt,
1001 ret = sev_es_ghcb_hv_call(ghcb, ctxt, exit_code, 0, 0);
1009 ctxt->regs->ax = ghcb->save.rax;
1010 ctxt->regs->dx = ghcb->save.rdx;
1012 ctxt->regs->cx = ghcb->save.rcx;
1120 struct es_em_ctxt ctxt;
1147 ret = sev_es_ghcb_hv_call(ghcb, &ctxt, SVM_VMGEXIT_PSC, 0, 0);
1182 static enum es_result vc_check_opcode_bytes(struct es_em_ctxt *ctxt,
1185 unsigned int opcode = (unsigned int)ctxt->insn.opcode.value;
1186 u8 modrm = ctxt->insn.modrm.value;
1242 X86_MODRM_REG(ctxt->insn.modrm.value) == 7)
1254 X86_MODRM_REG(ctxt->insn.modrm.value) == 7)
1268 opcode, exit_code, ctxt->regs->ip);