Files
MiniVisorPkg/Sources/Asm.h

110 lines
2.2 KiB
C
Raw Normal View History

2020-02-22 13:54:50 -08:00
/*!
@file Asm.h
@brief MASM-written functions.
@author Satoshi Tanda
@copyright Copyright (c) 2020 - , Satoshi Tanda. All rights reserved.
*/
#pragma once
#include "Common.h"
2020-03-07 10:47:18 -08:00
#if defined(MV_PLATFORM_WINDOWS)
2020-02-22 13:54:50 -08:00
#include "Platform/Windows/WinAsm.h"
#else
#include "Platform/EFI/EfiAsm.h"
#endif
/*!
2020-03-07 10:47:18 -08:00
@brief The entry point for the hypervisor.
2020-02-22 13:54:50 -08:00
2020-03-07 10:47:18 -08:00
@details See Asm.asm.
2020-02-22 13:54:50 -08:00
*/
VOID
AsmHypervisorEntryPoint (
);
/*!
2020-03-07 10:47:18 -08:00
@brief Invalidates translations derived from EPT.
2020-02-22 13:54:50 -08:00
2020-03-07 10:47:18 -08:00
@param[in] InvEptType - The type of invalidation.
2020-02-22 13:54:50 -08:00
2020-03-07 10:47:18 -08:00
@param[in] InvEptDescriptor - The description of translations to invalidate.
2020-02-22 13:54:50 -08:00
@return An appropriate VMX_RESULT value.
*/
VMX_RESULT
AsmInvept (
_In_ INVEPT_TYPE InvEptType,
_In_ CONST INVEPT_DESCRIPTOR* InvEptDescriptor
);
/*!
2020-03-07 10:47:18 -08:00
@brief Invalidates translations based on VPID.
2020-02-22 13:54:50 -08:00
2020-03-07 10:47:18 -08:00
@param[in] InvVpidType - The type of invalidation.
2020-02-22 13:54:50 -08:00
2020-03-07 10:47:18 -08:00
@param[in] InvVpidDescriptor - The description of translations to invalidate.
2020-02-22 13:54:50 -08:00
@return An appropriate VMX_RESULT value.
*/
VMX_RESULT
AsmInvvpid (
_In_ INVVPID_TYPE InvVpidType,
_In_ CONST INVVPID_DESCRIPTOR* InvVpidDescriptor
);
/*!
@brief Reads the access rights byte of the segment.
@details See: LAR-Load Access Rights Byte
@param[in] SegmentSelector - The selector of the segment to read.
@return The access rights byte of the segment, or 0 on failure.
*/
UINT32
AsmLoadAccessRightsByte (
_In_ UINT16 SegmentSelector
);
/*!
@brief Issues hypercall.
@param[in] HyperCallNumber - The hypercall number.
@param[in] Parameter1 - The arbitrary 64bit parameter 1.
@param[in] Parameter2 - The arbitrary 64bit parameter 2.
@param[in] Parameter3 - The arbitrary 64bit parameter 3.
@return The 64bit return value. Meaning is depends on HyperCallNumber.
*/
UINT64
AsmVmxCall (
_In_ UINT64 HyperCallNumber,
_In_ UINT64 Parameter1,
_In_ UINT64 Parameter2,
_In_ UINT64 Parameter3
);
/*!
2020-03-07 10:47:18 -08:00
@brief Returns the return address from this function.
2020-02-22 13:54:50 -08:00
2020-03-07 10:47:18 -08:00
@return The return address from this function.
2020-02-22 13:54:50 -08:00
*/
UINT64
AsmGetCurrentInstructionPointer (
);
/*!
@brief Returns the current value of RSP.
@return The current value of RSP.
*/
UINT64
AsmGetCurrentStackPointer (
);