Lines Matching full:vcpu
289 vie_read_register(struct vcpu *vcpu, enum vm_reg_name reg, uint64_t *rval) in vie_read_register() argument
293 error = vm_get_register(vcpu, reg, rval); in vie_read_register()
325 vie_read_bytereg(struct vcpu *vcpu, struct vie *vie, uint8_t *rval) in vie_read_bytereg() argument
332 error = vm_get_register(vcpu, reg, &val); in vie_read_bytereg()
346 vie_write_bytereg(struct vcpu *vcpu, struct vie *vie, uint8_t byte) in vie_write_bytereg() argument
353 error = vm_get_register(vcpu, reg, &origval); in vie_write_bytereg()
366 error = vm_set_register(vcpu, reg, val); in vie_write_bytereg()
372 vie_update_register(struct vcpu *vcpu, enum vm_reg_name reg, in vie_update_register() argument
381 error = vie_read_register(vcpu, reg, &origval); in vie_update_register()
396 error = vm_set_register(vcpu, reg, val); in vie_update_register()
508 emulate_mov(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_mov() argument
527 error = vie_read_bytereg(vcpu, vie, &byte); in emulate_mov()
529 error = memwrite(vcpu, gpa, byte, size, arg); in emulate_mov()
539 error = vie_read_register(vcpu, reg, &val); in emulate_mov()
542 error = memwrite(vcpu, gpa, val, size, arg); in emulate_mov()
552 error = memread(vcpu, gpa, &val, size, arg); in emulate_mov()
554 error = vie_write_bytereg(vcpu, vie, val); in emulate_mov()
563 error = memread(vcpu, gpa, &val, size, arg); in emulate_mov()
566 error = vie_update_register(vcpu, reg, val, size); in emulate_mov()
576 error = memread(vcpu, gpa, &val, size, arg); in emulate_mov()
579 error = vie_update_register(vcpu, reg, val, size); in emulate_mov()
589 error = vie_read_register(vcpu, VM_REG_GUEST_RAX, &val); in emulate_mov()
592 error = memwrite(vcpu, gpa, val, size, arg); in emulate_mov()
602 error = memwrite(vcpu, gpa, vie->immediate, size, arg); in emulate_mov()
612 error = memwrite(vcpu, gpa, val, size, arg); in emulate_mov()
622 emulate_movx(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_movx() argument
644 error = memread(vcpu, gpa, &val, 1, arg); in emulate_movx()
655 error = vie_update_register(vcpu, reg, val, size); in emulate_movx()
665 error = memread(vcpu, gpa, &val, 2, arg); in emulate_movx()
674 error = vie_update_register(vcpu, reg, val, size); in emulate_movx()
687 error = memread(vcpu, gpa, &val, 1, arg); in emulate_movx()
698 error = vie_update_register(vcpu, reg, val, size); in emulate_movx()
710 get_gla(struct vcpu *vcpu, struct vie *vie __unused, in get_gla() argument
718 error = vie_read_register(vcpu, VM_REG_GUEST_CR0, &cr0); in get_gla()
721 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in get_gla()
724 error = vm_get_seg_desc(vcpu, seg, &desc); in get_gla()
728 error = vie_read_register(vcpu, gpr, &val); in get_gla()
735 vm_inject_ss(vcpu, 0); in get_gla()
737 vm_inject_gp(vcpu); in get_gla()
743 vm_inject_ss(vcpu, 0); in get_gla()
745 vm_inject_gp(vcpu); in get_gla()
750 vm_inject_ac(vcpu, 0); in get_gla()
763 emulate_movs(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_movs() argument
790 error = vie_read_register(vcpu, VM_REG_GUEST_RCX, &rcx); in emulate_movs()
820 error = get_gla(vcpu, vie, paging, opsize, vie->addrsize, in emulate_movs()
825 error = vm_copy_setup(vcpu, paging, srcaddr, opsize, PROT_READ, in emulate_movs()
836 error = memwrite(vcpu, gpa, val, opsize, arg); in emulate_movs()
845 error = get_gla(vcpu, vie, paging, opsize, vie->addrsize, in emulate_movs()
851 error = vm_copy_setup(vcpu, paging, dstaddr, opsize, in emulate_movs()
866 error = memread(vcpu, gpa, &val, opsize, arg); in emulate_movs()
881 error = vm_gla2gpa(vcpu, paging, srcaddr, in emulate_movs()
886 error = vm_gla2gpa(vcpu, paging, dstaddr, in emulate_movs()
891 error = memread(vcpu, srcgpa, &val, opsize, arg); in emulate_movs()
895 error = memwrite(vcpu, dstgpa, val, opsize, arg); in emulate_movs()
901 error = vie_read_register(vcpu, VM_REG_GUEST_RSI, &rsi); in emulate_movs()
904 error = vie_read_register(vcpu, VM_REG_GUEST_RDI, &rdi); in emulate_movs()
907 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_movs()
918 error = vie_update_register(vcpu, VM_REG_GUEST_RSI, rsi, in emulate_movs()
922 error = vie_update_register(vcpu, VM_REG_GUEST_RDI, rdi, in emulate_movs()
928 error = vie_update_register(vcpu, VM_REG_GUEST_RCX, in emulate_movs()
936 vm_restart_instruction(vcpu); in emulate_movs()
945 emulate_stos(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_stos() argument
957 error = vie_read_register(vcpu, VM_REG_GUEST_RCX, &rcx); in emulate_stos()
968 error = vie_read_register(vcpu, VM_REG_GUEST_RAX, &val); in emulate_stos()
971 error = memwrite(vcpu, gpa, val, opsize, arg); in emulate_stos()
975 error = vie_read_register(vcpu, VM_REG_GUEST_RDI, &rdi); in emulate_stos()
978 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_stos()
986 error = vie_update_register(vcpu, VM_REG_GUEST_RDI, rdi, in emulate_stos()
992 error = vie_update_register(vcpu, VM_REG_GUEST_RCX, in emulate_stos()
1000 vm_restart_instruction(vcpu); in emulate_stos()
1007 emulate_and(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_and() argument
1030 error = vie_read_register(vcpu, reg, &val1); in emulate_and()
1035 error = memread(vcpu, gpa, &val2, size, arg); in emulate_and()
1041 error = vie_update_register(vcpu, reg, result, size); in emulate_and()
1059 error = memread(vcpu, gpa, &val1, size, arg); in emulate_and()
1068 error = memwrite(vcpu, gpa, result, size, arg); in emulate_and()
1076 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_and()
1090 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, rflags, 8); in emulate_and()
1095 emulate_or(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_or() argument
1118 error = vie_read_register(vcpu, reg, &val1); in emulate_or()
1123 error = memread(vcpu, gpa, &val2, size, arg); in emulate_or()
1129 error = vie_update_register(vcpu, reg, result, size); in emulate_or()
1147 error = memread(vcpu, gpa, &val1, size, arg); in emulate_or()
1156 error = memwrite(vcpu, gpa, result, size, arg); in emulate_or()
1164 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_or()
1178 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, rflags, 8); in emulate_or()
1183 emulate_cmp(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_cmp() argument
1211 error = vie_read_register(vcpu, reg, ®op); in emulate_cmp()
1216 error = memread(vcpu, gpa, &memop, size, arg); in emulate_cmp()
1255 error = memread(vcpu, gpa, &op1, size, arg); in emulate_cmp()
1264 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_cmp()
1270 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, rflags, 8); in emulate_cmp()
1275 emulate_test(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_test() argument
1299 error = memread(vcpu, gpa, &op1, size, arg); in emulate_test()
1308 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_test()
1319 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, rflags, 8); in emulate_test()
1324 emulate_bextr(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_bextr() argument
1352 error = memread(vcpu, gpa, &src1, size, arg); in emulate_bextr()
1355 error = vie_read_register(vcpu, gpr_map[vie->vex_reg], &src2); in emulate_bextr()
1358 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_bextr()
1384 error = vie_update_register(vcpu, gpr_map[vie->reg], dst, size); in emulate_bextr()
1395 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, rflags, in emulate_bextr()
1401 emulate_add(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_add() argument
1423 error = vie_read_register(vcpu, reg, &val1); in emulate_add()
1428 error = memread(vcpu, gpa, &val2, size, arg); in emulate_add()
1434 error = vie_update_register(vcpu, reg, nval, size); in emulate_add()
1442 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, in emulate_add()
1449 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, in emulate_add()
1457 emulate_sub(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_sub() argument
1479 error = vie_read_register(vcpu, reg, &val1); in emulate_sub()
1484 error = memread(vcpu, gpa, &val2, size, arg); in emulate_sub()
1490 error = vie_update_register(vcpu, reg, nval, size); in emulate_sub()
1498 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, in emulate_sub()
1505 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, in emulate_sub()
1513 emulate_stack_op(struct vcpu *vcpu, uint64_t mmio_gpa, struct vie *vie, in emulate_stack_op() argument
1551 error = vm_get_seg_desc(vcpu, VM_REG_GUEST_SS, &ss_desc); in emulate_stack_op()
1560 error = vie_read_register(vcpu, VM_REG_GUEST_CR0, &cr0); in emulate_stack_op()
1563 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_stack_op()
1566 error = vie_read_register(vcpu, VM_REG_GUEST_RSP, &rsp); in emulate_stack_op()
1575 vm_inject_ss(vcpu, 0); in emulate_stack_op()
1580 vm_inject_ss(vcpu, 0); in emulate_stack_op()
1585 vm_inject_ac(vcpu, 0); in emulate_stack_op()
1589 error = vm_copy_setup(vcpu, paging, stack_gla, size, in emulate_stack_op()
1596 error = memread(vcpu, mmio_gpa, &val, size, arg); in emulate_stack_op()
1601 error = memwrite(vcpu, mmio_gpa, val, size, arg); in emulate_stack_op()
1607 error = vie_update_register(vcpu, VM_REG_GUEST_RSP, rsp, in emulate_stack_op()
1615 emulate_push(struct vcpu *vcpu, uint64_t mmio_gpa, struct vie *vie, in emulate_push() argument
1630 error = emulate_stack_op(vcpu, mmio_gpa, vie, paging, memread, in emulate_push()
1636 emulate_pop(struct vcpu *vcpu, uint64_t mmio_gpa, struct vie *vie, in emulate_pop() argument
1651 error = emulate_stack_op(vcpu, mmio_gpa, vie, paging, memread, in emulate_pop()
1657 emulate_group1(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_group1() argument
1665 error = emulate_or(vcpu, gpa, vie, in emulate_group1()
1669 error = emulate_and(vcpu, gpa, vie, in emulate_group1()
1673 error = emulate_cmp(vcpu, gpa, vie, in emulate_group1()
1685 emulate_bittest(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_bittest() argument
1701 error = vie_read_register(vcpu, VM_REG_GUEST_RFLAGS, &rflags); in emulate_bittest()
1704 error = memread(vcpu, gpa, &val, vie->opsize, memarg); in emulate_bittest()
1721 error = vie_update_register(vcpu, VM_REG_GUEST_RFLAGS, rflags, 8); in emulate_bittest()
1728 emulate_twob_group15(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in emulate_twob_group15() argument
1748 error = memread(vcpu, gpa, &buf, 1, memarg); in emulate_twob_group15()
1760 vmm_emulate_instruction(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, in vmm_emulate_instruction() argument
1771 error = emulate_group1(vcpu, gpa, vie, paging, memread, in vmm_emulate_instruction()
1775 error = emulate_pop(vcpu, gpa, vie, paging, memread, in vmm_emulate_instruction()
1779 error = emulate_push(vcpu, gpa, vie, paging, memread, in vmm_emulate_instruction()
1783 error = emulate_cmp(vcpu, gpa, vie, in vmm_emulate_instruction()
1787 error = emulate_mov(vcpu, gpa, vie, in vmm_emulate_instruction()
1792 error = emulate_movx(vcpu, gpa, vie, in vmm_emulate_instruction()
1796 error = emulate_movs(vcpu, gpa, vie, paging, memread, in vmm_emulate_instruction()
1800 error = emulate_stos(vcpu, gpa, vie, paging, memread, in vmm_emulate_instruction()
1804 error = emulate_and(vcpu, gpa, vie, in vmm_emulate_instruction()
1808 error = emulate_or(vcpu, gpa, vie, in vmm_emulate_instruction()
1812 error = emulate_sub(vcpu, gpa, vie, in vmm_emulate_instruction()
1816 error = emulate_bittest(vcpu, gpa, vie, in vmm_emulate_instruction()
1820 error = emulate_twob_group15(vcpu, gpa, vie, in vmm_emulate_instruction()
1824 error = emulate_add(vcpu, gpa, vie, memread, in vmm_emulate_instruction()
1828 error = emulate_test(vcpu, gpa, vie, in vmm_emulate_instruction()
1832 error = emulate_bextr(vcpu, gpa, vie, paging, in vmm_emulate_instruction()
2055 ptp_hold(struct vcpu *vcpu, vm_paddr_t ptpphys, size_t len, void **cookie) in ptp_hold() argument
2060 ptr = vm_gpa_hold(vcpu, ptpphys, len, VM_PROT_RW, cookie); in ptp_hold()
2065 _vm_gla2gpa(struct vcpu *vcpu, struct vm_guest_paging *paging, in _vm_gla2gpa() argument
2093 vm_inject_gp(vcpu); in _vm_gla2gpa()
2108 ptpbase32 = ptp_hold(vcpu, ptpphys, PAGE_SIZE, in _vm_gla2gpa()
2126 vm_inject_pf(vcpu, pfcode, gla); in _vm_gla2gpa()
2170 ptpbase = ptp_hold(vcpu, ptpphys, sizeof(*ptpbase) * 4, in _vm_gla2gpa()
2182 vm_inject_pf(vcpu, pfcode, gla); in _vm_gla2gpa()
2200 ptpbase = ptp_hold(vcpu, ptpphys, PAGE_SIZE, &cookie); in _vm_gla2gpa()
2215 vm_inject_pf(vcpu, pfcode, gla); in _vm_gla2gpa()
2233 vm_inject_pf(vcpu, pfcode, gla); in _vm_gla2gpa()
2266 vm_gla2gpa(struct vcpu *vcpu, struct vm_guest_paging *paging, in vm_gla2gpa() argument
2270 return (_vm_gla2gpa(vcpu, paging, gla, prot, gpa, guest_fault, in vm_gla2gpa()
2275 vm_gla2gpa_nofault(struct vcpu *vcpu, struct vm_guest_paging *paging, in vm_gla2gpa_nofault() argument
2279 return (_vm_gla2gpa(vcpu, paging, gla, prot, gpa, guest_fault, in vm_gla2gpa_nofault()
2284 vmm_fetch_instruction(struct vcpu *vcpu, struct vm_guest_paging *paging, in vmm_fetch_instruction() argument
2294 error = vm_copy_setup(vcpu, paging, rip, inst_length, prot, in vmm_fetch_instruction()
2812 verify_gla(struct vcpu *vcpu, uint64_t gla, struct vie *vie, in verify_gla() argument
2826 error = vm_get_register(vcpu, vie->base_register, &base); in verify_gla()
2843 error = vm_get_register(vcpu, vie->index_register, &idx); in verify_gla()
2875 error = vm_get_seg_desc(vcpu, seg, &desc); in verify_gla()
2902 vmm_decode_instruction(struct vcpu *vcpu, uint64_t gla, in vmm_decode_instruction() argument
2932 if (verify_gla(vcpu, gla, vie, cpu_mode)) in vmm_decode_instruction()