2019-12-02 15:45:02 -08:00
|
|
|
/** @file
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
|
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
|
#include <Library/BootloaderCoreLib.h>
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
This function sets the Loader global data pointer.
|
|
|
|
|
|
|
|
|
|
@param[in] LoaderData Loader data pointer.
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
VOID
|
|
|
|
|
EFIAPI
|
|
|
|
|
SetLoaderGlobalDataPointer (
|
|
|
|
|
IN LOADER_GLOBAL_DATA *LoaderData
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
IA32_DESCRIPTOR Idtr;
|
|
|
|
|
|
|
|
|
|
AsmReadIdtr (&Idtr);
|
2020-03-27 17:34:33 -07:00
|
|
|
(* (UINTN *) (Idtr.Base - sizeof (UINT64))) = (UINTN)LoaderData;
|
2019-12-02 15:45:02 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
This function gets the Loader global data pointer.
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
LOADER_GLOBAL_DATA *
|
|
|
|
|
EFIAPI
|
|
|
|
|
GetLoaderGlobalDataPointer (
|
|
|
|
|
VOID
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
IA32_DESCRIPTOR Idtr;
|
|
|
|
|
|
|
|
|
|
AsmReadIdtr (&Idtr);
|
2020-03-27 17:34:33 -07:00
|
|
|
return (LOADER_GLOBAL_DATA *) (* (UINTN *) (Idtr.Base - sizeof (UINT64)));
|
2019-12-02 15:45:02 -08:00
|
|
|
}
|