VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h@ 101291

Last change on this file since 101291 was 101291, checked in by vboxsync, 14 months ago

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/** @file
2 SMRAM Save State Map header file.
3
4 Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
5 Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#ifndef MM_SAVESTATE_H_
11#define MM_SAVESTATE_H_
12
13#include <Uefi/UefiBaseType.h>
14#include <Protocol/MmCpu.h>
15#include <Library/DebugLib.h>
16#include <Library/MmSaveStateLib.h>
17#include <Library/MmServicesTableLib.h>
18#include <Library/BaseMemoryLib.h>
19
20// Macro used to simplify the lookup table entries of type CPU_MM_SAVE_STATE_REGISTER_RANGE
21#define MM_REGISTER_RANGE(Start, End) { Start, End, End - Start + 1 }
22
23// Structure used to describe a range of registers
24typedef struct {
25 EFI_MM_SAVE_STATE_REGISTER Start;
26 EFI_MM_SAVE_STATE_REGISTER End;
27 UINTN Length;
28} CPU_MM_SAVE_STATE_REGISTER_RANGE;
29
30// Structure used to build a lookup table to retrieve the widths and offsets
31// associated with each supported EFI_MM_SAVE_STATE_REGISTER value
32
33typedef struct {
34 UINT8 Width32;
35 UINT8 Width64;
36 UINT16 Offset32;
37 UINT16 Offset64Lo;
38 UINT16 Offset64Hi;
39 BOOLEAN Writeable;
40} CPU_MM_SAVE_STATE_LOOKUP_ENTRY;
41
42/**
43 Returns LMA value of the Processor.
44
45 @retval UINT8 returns LMA bit value.
46**/
47UINT8
48MmSaveStateGetRegisterLma (
49 VOID
50 );
51
52/**
53 Read information from the CPU save state.
54
55 @param Register Specifies the CPU register to read form the save state.
56 @param RegOffset Offset for the next register index.
57
58 @retval 0 Register is not valid
59 @retval >0 Index into mCpuWidthOffset[] associated with Register
60
61**/
62UINTN
63MmSaveStateGetRegisterIndex (
64 IN EFI_MM_SAVE_STATE_REGISTER Register,
65 IN UINTN RegOffset
66 );
67
68/**
69 Read a CPU Save State register on the target processor.
70
71 This function abstracts the differences that whether the CPU Save State register is in the
72 IA32 CPU Save State Map or X64 CPU Save State Map.
73
74 This function supports reading a CPU Save State register in SMBase relocation handler.
75
76 @param[in] CpuIndex Specifies the zero-based index of the CPU save state.
77 @param[in] RegisterIndex Index into mCpuWidthOffset[] look up table.
78 @param[in] Width The number of bytes to read from the CPU save state.
79 @param[out] Buffer Upon return, this holds the CPU register value read from the save state.
80
81 @retval EFI_SUCCESS The register was read from Save State.
82 @retval EFI_NOT_FOUND The register is not defined for the Save State of Processor.
83 @retval EFI_INVALID_PARAMTER This or Buffer is NULL.
84
85**/
86EFI_STATUS
87MmSaveStateReadRegisterByIndex (
88 IN UINTN CpuIndex,
89 IN UINTN RegisterIndex,
90 IN UINTN Width,
91 OUT VOID *Buffer
92 );
93
94#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette