/// make a page shared with the GHCB MSR Protocol
make a page shared with the GHCB MSR Protocol
make a page shared with the GHCB MSR Protocol
fn ghcb_msr_make_page_shared(page_virt: VirtAddr) {
    // const SNP_PAGE_STATE_PRIVATE: u64 = 1;
    const SNP_PAGE_STATE_SHARED: u64 = 2;
    smash(page_virt).unwrap();
    unsafe { pvalidate(page_virt, PvalidateSize::Size4K, false).unwrap() };
    if clear_c_bit_address_range(page_virt, page_virt + Page::<Size4KiB>::SIZE).is_err() {
        unsafe {
            crate::debug::_early_debug_panic(4, 0x30);
        }
    }
    let gpa = page_virt - SHIM_VIRT_OFFSET;
    const SHARED_BIT: u64 = SNP_PAGE_STATE_SHARED << GhcbMsr::PSC_OP_POS;
    let val = gpa.as_u64() | SHARED_BIT;
    unsafe {
        let ret = vmgexit_msr(GhcbMsr::PSC_REQ, val, GhcbMsr::PSC_RESP);
        if (ret & GhcbMsr::PSC_ERROR_MASK) != 0 {
            crate::debug::_early_debug_panic(4, 0x33);
        }
    }
}
fn ghcb_msr_make_page_shared ( page_virt : VirtAddr ) { // const SNP_PAGE_STATE_PRIVATE: u64 = 1; const SNP_PAGE_STATE_SHARED : u64 = 2 ; smash ( page_virt ) . unwrap ( ) ; unsafe { pvalidate ( page_virt , PvalidateSize :: Size4K , false ) . unwrap ( ) } ; if clear_c_bit_address_range ( page_virt , page_virt + Page :: < Size4KiB > :: SIZE ) . is_err ( ) { unsafe { crate :: debug :: _early_debug_panic ( 4 , 0x30 ) ; } } let gpa = page_virt - SHIM_VIRT_OFFSET ; const SHARED_BIT : u64 = SNP_PAGE_STATE_SHARED << GhcbMsr :: PSC_OP_POS ; let val = gpa . as_u64 ( ) | SHARED_BIT ; unsafe { let ret = vmgexit_msr ( GhcbMsr :: PSC_REQ , val , GhcbMsr :: PSC_RESP ) ; if ( ret & GhcbMsr :: PSC_ERROR_MASK ) != 0 { crate :: debug :: _early_debug_panic ( 4 , 0x33 ) ; } } }
make a page shared with the GHCB MSR Protocol
make a page shared with the GHCB MSR Protocol
page_virt
VirtAddr