2 PEI Services Table Pointer Library for IA-32 and x64.
4 According to PI specification, the peiservice pointer is stored prior at IDT
5 table in IA32 and x64 architecture.
7 Copyright (c) 2006 - 2007, Intel Corporation.<BR>
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Library/BaseLib.h>
21 #include <Library/PeiServicesTablePointerLib.h>
22 #include <Library/DebugLib.h>
26 The function returns the pointer to PeiServicee following
29 For IA32, the four-bytes field immediately prior to new IDT
30 base addres is used to save the EFI_PEI_SERVICES**.
31 For x64, the eight-bytes field immediately prior to new IDT
32 base addres is used to save the EFI_PEI_SERVICES**
34 @return The pointer to PeiServices.
37 CONST EFI_PEI_SERVICES
**
39 GetPeiServicesTablePointer (
43 CONST EFI_PEI_SERVICES
**PeiServices
;
47 PeiServices
= (CONST EFI_PEI_SERVICES
**) (*(UINTN
*)(Idtr
.Base
- sizeof (UINTN
)));
48 ASSERT (PeiServices
!= NULL
);
54 The function sets the pointer to PeiServicee following
57 For IA32, the four-bytes field immediately prior to new IDT
58 base addres is used to save the EFI_PEI_SERVICES**.
59 For x64, the eight-bytes field immediately prior to new IDT
60 base addres is used to save the EFI_PEI_SERVICES**
62 @param PeiServicesTablePointer The pointer to PeiServices.
67 SetPeiServicesTablePointer (
68 IN CONST EFI_PEI_SERVICES
** PeiServicesTablePointer
74 (*(UINTN
*)(Idtr
.Base
- sizeof (UINTN
))) = (UINTN
)PeiServicesTablePointer
;