TianoCore EDK2 master
VmTdExitVeHandler.c File Reference

Go to the source code of this file.

Data Structures

union  MSR_DATA
 
union  REX
 
union  MODRM
 
struct  CPUID_DATA
 

Macros

#define TDX_DECODER_BUG_ON(x)
 

Functions

STATIC UINT64 EFIAPI CpuIdExit (IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
 
STATIC UINT64 EFIAPI IoExit (IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
 
STATIC UINT64 ReadMsrExit (IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
 
STATIC UINT64 WriteMsrExit (IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
 
STATIC VOID EFIAPI TdxDecodeInstruction (IN UINT8 *Rip)
 
STATIC UINT64 *EFIAPI GetRegFromContext (IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN UINTN RegIndex)
 
STATIC INTN EFIAPI MmioExit (IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo)
 
EFI_STATUS EFIAPI VmTdExitHandleVe (IN OUT EFI_EXCEPTION_TYPE *ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext)
 

Detailed Description

Copyright (c) 2021, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file VmTdExitVeHandler.c.

Macro Definition Documentation

◆ TDX_DECODER_BUG_ON

#define TDX_DECODER_BUG_ON (   x)
Value:
if ((x)) { \
TdxDecodeInstruction(Rip); \
TdVmCall(TDVMCALL_HALT, 0, 0, 0, 0, 0); \
}

Definition at line 232 of file VmTdExitVeHandler.c.

Function Documentation

◆ CpuIdExit()

Handle an CPUID event.

Use the TDVMCALL instruction to handle cpuid #ve

Parameters
[in,out]Regsx64 processor context
[in]VeinfoVE Info
Return values
0Event handled successfully
Returns
New exception value to propagate

Definition at line 62 of file VmTdExitVeHandler.c.

◆ GetRegFromContext()

STATIC UINT64 *EFIAPI GetRegFromContext ( IN EFI_SYSTEM_CONTEXT_X64 Regs,
IN UINTN  RegIndex 
)

Definition at line 241 of file VmTdExitVeHandler.c.

◆ IoExit()

Handle an IO event.

Use the TDVMCALL instruction to handle either an IO read or an IO write.

Parameters
[in,out]Regsx64 processor context
[in]VeinfoVE Info
Return values
0Event handled successfully
Returns
New exception value to propagate

Definition at line 96 of file VmTdExitVeHandler.c.

◆ MmioExit()

Handle an MMIO event.

Use the TDVMCALL instruction to handle either an mmio read or an mmio write.

Parameters
[in,out]Regsx64 processor context
[in]VeinfoVE Info
Return values
0Event handled successfully
Returns
New exception value to propagate

Definition at line 298 of file VmTdExitVeHandler.c.

◆ ReadMsrExit()

STATIC UINT64 ReadMsrExit ( IN OUT EFI_SYSTEM_CONTEXT_X64 Regs,
IN TDCALL_VEINFO_RETURN_DATA Veinfo 
)

Handle an READ MSR event.

Use the TDVMCALL instruction to handle msr read

Parameters
[in,out]Regsx64 processor context
[in]VeinfoVE Info
Return values
0Event handled successfully
Returns
New exception value to propagate

Definition at line 169 of file VmTdExitVeHandler.c.

◆ TdxDecodeInstruction()

STATIC VOID EFIAPI TdxDecodeInstruction ( IN UINT8 Rip)

Definition at line 218 of file VmTdExitVeHandler.c.

◆ VmTdExitHandleVe()

EFI_STATUS EFIAPI VmTdExitHandleVe ( IN OUT EFI_EXCEPTION_TYPE ExceptionType,
IN OUT EFI_SYSTEM_CONTEXT  SystemContext 
)

Handle a #VE exception.

Performs the necessary processing to handle a #VE exception.

Parameters
[in,out]ExceptionTypePointer to an EFI_EXCEPTION_TYPE to be set as value to use on error.
[in,out]SystemContextPointer to EFI_SYSTEM_CONTEXT
Return values
EFI_SUCCESSException handled
EFI_UNSUPPORTED#VE not supported, (new) exception value to propagate provided
EFI_PROTOCOL_ERROR#VE handling failed, (new) exception value to propagate provided

Definition at line 449 of file VmTdExitVeHandler.c.

◆ WriteMsrExit()

STATIC UINT64 WriteMsrExit ( IN OUT EFI_SYSTEM_CONTEXT_X64 Regs,
IN TDCALL_VEINFO_RETURN_DATA Veinfo 
)

Handle an WRITE MSR event.

Use the TDVMCALL instruction to handle msr write

Parameters
[in,out]Regsx64 processor context
[in]VeinfoVE Info
Return values
0Event handled successfully
Returns
New exception value to propagate

Definition at line 199 of file VmTdExitVeHandler.c.