Lines Matching refs:vme
448 riscv_handle_world_switch(struct hypctx *hypctx, struct vm_exit *vme, in riscv_handle_world_switch() argument
460 if (vme->scause & SCAUSE_INTR) { in riscv_handle_world_switch()
465 vme->exitcode = VM_EXITCODE_BOGUS; in riscv_handle_world_switch()
466 vme->inst_length = 0; in riscv_handle_world_switch()
470 switch (vme->scause) { in riscv_handle_world_switch()
474 gpa = (vme->htval << 2) | (vme->stval & 0x3); in riscv_handle_world_switch()
476 vme->exitcode = VM_EXITCODE_PAGING; in riscv_handle_world_switch()
477 vme->inst_length = 0; in riscv_handle_world_switch()
478 vme->u.paging.gpa = gpa; in riscv_handle_world_switch()
480 ret = riscv_gen_inst_emul_data(hypctx, vme, &trap); in riscv_handle_world_switch()
482 vme->exitcode = VM_EXITCODE_HYP; in riscv_handle_world_switch()
483 vme->u.hyp.scause = trap.scause; in riscv_handle_world_switch()
486 vme->exitcode = VM_EXITCODE_INST_EMUL; in riscv_handle_world_switch()
494 "0x%lx\n", __func__, vme->sepc, vme->stval, vme->htval); in riscv_handle_world_switch()
496 vme->exitcode = VM_EXITCODE_BOGUS; in riscv_handle_world_switch()
503 for (i = 0; i < nitems(vme->u.ecall.args); i++) in riscv_handle_world_switch()
504 vme->u.ecall.args[i] = hypctx->guest_regs.hyp_a[i]; in riscv_handle_world_switch()
505 vme->exitcode = VM_EXITCODE_ECALL; in riscv_handle_world_switch()
508 insn = vme->stval; in riscv_handle_world_switch()
510 vme->exitcode = VM_EXITCODE_WFI; in riscv_handle_world_switch()
512 vme->exitcode = VM_EXITCODE_BOGUS; in riscv_handle_world_switch()
516 printf("unknown scause %lx\n", vme->scause); in riscv_handle_world_switch()
518 vme->exitcode = VM_EXITCODE_BOGUS; in riscv_handle_world_switch()
606 struct vm_exit *vme; in vmmops_run() local
614 vme = vm_exitinfo(vcpu); in vmmops_run()
699 vme->scause = csr_read(scause); in vmmops_run()
700 vme->sepc = csr_read(sepc); in vmmops_run()
701 vme->stval = csr_read(stval); in vmmops_run()
702 vme->htval = csr_read(htval); in vmmops_run()
703 vme->htinst = csr_read(htinst); in vmmops_run()
708 vme->pc = hypctx->guest_regs.hyp_sepc; in vmmops_run()
709 vme->inst_length = INSN_SIZE; in vmmops_run()
711 handled = riscv_handle_world_switch(hypctx, vme, pmap); in vmmops_run()
717 hypctx->guest_regs.hyp_sepc += vme->inst_length; in vmmops_run()