TianoCore EDK2 master
|
#include <Base.h>
#include <Uefi.h>
#include <Library/BaseMemoryLib.h>
#include <Register/Intel/Cpuid.h>
#include <IndustryStandard/InstructionParsing.h>
#include "CcInstruction.h"
Go to the source code of this file.
Macros | |
#define | MAX_INSTRUCTION_LENGTH 15 |
Functions | |
UINT64 * | CcGetRegisterPointer (IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN UINT8 Register) |
STATIC VOID | UpdateForDisplacement (IN OUT CC_INSTRUCTION_DATA *InstructionData, IN UINTN Size) |
STATIC BOOLEAN | IsRipRelative (IN CC_INSTRUCTION_DATA *InstructionData) |
STATIC UINT64 | GetEffectiveMemoryAddress (IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData) |
VOID | CcDecodeModRm (IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN OUT CC_INSTRUCTION_DATA *InstructionData) |
STATIC EFI_STATUS | DecodePrefixes (IN EFI_SYSTEM_CONTEXT_X64 *Regs, IN OUT CC_INSTRUCTION_DATA *InstructionData) |
UINT64 | CcInstructionLength (IN CC_INSTRUCTION_DATA *InstructionData) |
EFI_STATUS | CcInitInstructionData (IN OUT CC_INSTRUCTION_DATA *InstructionData, IN GHCB *Ghcb, IN EFI_SYSTEM_CONTEXT_X64 *Regs) |
X64 Instruction function.
Copyright (C) 2020, Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CcInstruction.c.
#define MAX_INSTRUCTION_LENGTH 15 |
Definition at line 16 of file CcInstruction.c.
VOID CcDecodeModRm | ( | IN EFI_SYSTEM_CONTEXT_X64 * | Regs, |
IN OUT CC_INSTRUCTION_DATA * | InstructionData | ||
) |
Decode a ModRM byte.
Examine the instruction parsing context to decode a ModRM byte and the SIB byte, if present.
[in] | Regs | x64 processor context |
[in,out] | InstructionData | Instruction parsing context |
Definition at line 245 of file CcInstruction.c.
UINT64 * CcGetRegisterPointer | ( | IN EFI_SYSTEM_CONTEXT_X64 * | Regs, |
IN UINT8 | Register | ||
) |
Return a pointer to the contents of the specified register.
Based upon the input register, return a pointer to the registers contents in the x86 processor context.
[in] | Regs | x64 processor context |
[in] | Register | Register to obtain pointer for |
Definition at line 31 of file CcInstruction.c.
EFI_STATUS CcInitInstructionData | ( | IN OUT CC_INSTRUCTION_DATA * | InstructionData, |
IN GHCB * | Ghcb, | ||
IN EFI_SYSTEM_CONTEXT_X64 * | Regs | ||
) |
Initialize the instruction parsing context.
Initialize the instruction parsing context, which includes decoding the instruction prefixes.
[in,out] | InstructionData | Instruction parsing context |
[in] | Ghcb | Pointer to the Guest-Hypervisor Communication Block |
[in] | Regs | x64 processor context |
EFI_SUCCESS | Successfully initialize InstructionData |
Others | Other error as indicated |
Definition at line 442 of file CcInstruction.c.
UINT64 CcInstructionLength | ( | IN CC_INSTRUCTION_DATA * | InstructionData | ) |
Determine instruction length
Return the total length of the parsed instruction.
[in] | InstructionData | Instruction parsing context |
Definition at line 420 of file CcInstruction.c.
STATIC EFI_STATUS DecodePrefixes | ( | IN EFI_SYSTEM_CONTEXT_X64 * | Regs, |
IN OUT CC_INSTRUCTION_DATA * | InstructionData | ||
) |
Decode instruction prefixes.
Parse the instruction data to track the instruction prefixes that have been used.
[in] | Regs | x64 processor context |
[in,out] | InstructionData | Instruction parsing context |
EFI_SUCCESS | Successfully decode Prefixes |
Others | Other error as indicated |
Definition at line 307 of file CcInstruction.c.
STATIC UINT64 GetEffectiveMemoryAddress | ( | IN EFI_SYSTEM_CONTEXT_X64 * | Regs, |
IN CC_INSTRUCTION_DATA * | InstructionData | ||
) |
Return the effective address of a memory operand.
Examine the instruction parsing context to obtain the effective memory address of a memory operand.
[in] | Regs | x64 processor context |
[in] | InstructionData | Instruction parsing context |
Definition at line 157 of file CcInstruction.c.
STATIC BOOLEAN IsRipRelative | ( | IN CC_INSTRUCTION_DATA * | InstructionData | ) |
Determine if an instruction address if RIP relative.
Examine the instruction parsing context to determine if the address offset is relative to the instruction pointer.
[in] | InstructionData | Instruction parsing context |
TRUE | Instruction addressing is RIP relative |
FALSE | Instruction addressing is not RIP relative |
Definition at line 129 of file CcInstruction.c.
Update the instruction parsing context for displacement bytes.
[in,out] | InstructionData | Instruction parsing context |
[in] | Size | The instruction displacement size |
Definition at line 105 of file CcInstruction.c.