MCPcopy Create free account
hub / github.com/F-Stack/f-stack / svm_vcpu_mode

Function svm_vcpu_mode

freebsd/amd64/vmm/amd/svm.c:652–679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

650}
651
652static enum vm_cpu_mode
653svm_vcpu_mode(struct vmcb *vmcb)
654{
655 struct vmcb_segment seg;
656 struct vmcb_state *state;
657 int error;
658
659 state = &vmcb->state;
660
661 if (state->efer & EFER_LMA) {
662 error = vmcb_seg(vmcb, VM_REG_GUEST_CS, &seg);
663 KASSERT(error == 0, ("%s: vmcb_seg(cs) error %d", __func__,
664 error));
665
666 /*
667 * Section 4.8.1 for APM2, check if Code Segment has
668 * Long attribute set in descriptor.
669 */
670 if (seg.attrib & VMCB_CS_ATTRIB_L)
671 return (CPU_MODE_64BIT);
672 else
673 return (CPU_MODE_COMPATIBILITY);
674 } else if (state->cr0 & CR0_PE) {
675 return (CPU_MODE_PROTECTED);
676 } else {
677 return (CPU_MODE_REAL);
678 }
679}
680
681static enum vm_paging_mode
682svm_paging_mode(uint64_t cr0, uint64_t cr4, uint64_t efer)

Callers 1

svm_paging_infoFunction · 0.85

Calls 1

vmcb_segFunction · 0.85

Tested by

no test coverage detected