Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> Cc: Leif Lindholm <leif.lindh...@linaro.org> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> --- .../AArch64/TemporaryRamMigration.S | 63 +++++++++++++++++++ .../AArch64/TemporaryRamMigration.asm | 63 +++++++++++++++++++ MdeModulePkg/Core/Pei/PeiMain.inf | 4 ++ 3 files changed, 130 insertions(+) create mode 100644 MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.S create mode 100644 MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.asm
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.S b/MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.S new file mode 100644 index 0000000000..e73932daff --- /dev/null +++ b/MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.S @@ -0,0 +1,63 @@ +#------------------------------------------------------------------------------ +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#------------------------------------------------------------------------------ + +.text +.align 5 + +GCC_ASM_EXPORT(PeiTemporaryRamMigration) + +#------------------------------------------------------------------------------ +# VOID +# EFIAPI +# PeiTemporaryRamMigration ( +# IN PEI_CORE_TEMPORARY_RAM_TRANSITION *TempRamTransitionData +# ); +# +# @param[in] x0 Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION +# +# @return None This routine does not return +#------------------------------------------------------------------------------ +ASM_PFX(PeiTemporaryRamMigration): + + # + # We store the TempRamTransitionData pointer in x19. By the + # AArch64 calling convention we should normally save x19, but we + # won't be returning to the caller, so we don't need to save it. + # By the same rule, the TemporaryRamMigration PPI call should + # preserve x19 for us. + # + mov x19, x0 + + # + # Setup parameters and call TemporaryRamSupport->TemporaryRamMigration + # (rcx) PeiServices + # (rdx) TemporaryMemoryBase + # (r8) PermanentMemoryBase + # (r9) CopySize + # + ldp x0, x1, [x19, 0x08] + ldp x2, x3, [x19, 0x18] + + # + # (x19) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION on stack + # + # Adjusted based on stack change made during + # TemporaryRamSupport->TemporaryRamMigration call + # + ldr x4, [x19] + mov x5, sp + sub x19, x19, x5 + blr x4 + mov x5, sp + add x19, x19, x5 + + # + # Setup parameters and call PeiTemporaryRamMigrated + # (x0) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION + # + mov x0, x19 + bl ASM_PFX(PeiTemporaryRamMigrated) diff --git a/MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.asm b/MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.asm new file mode 100644 index 0000000000..fbffd16c52 --- /dev/null +++ b/MdeModulePkg/Core/Pei/Dispatcher/AArch64/TemporaryRamMigration.asm @@ -0,0 +1,63 @@ +;------------------------------------------------------------------------------ +; +; Copyright (c) 2019, Intel Corporation. All rights reserved.<BR> +; SPDX-License-Identifier: BSD-2-Clause-Patent +; +;------------------------------------------------------------------------------ + + EXPORT PeiTemporaryRamMigration + AREA PeiCore_LowLevel, CODE, READONLY + +;------------------------------------------------------------------------------ +; VOID +; EFIAPI +; PeiTemporaryRamMigration ( +; IN PEI_CORE_TEMPORARY_RAM_TRANSITION *TempRamTransitionData +; ); +; +; @param[in] x0 Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION +; +; @return None This routine does not return +;------------------------------------------------------------------------------ +PeiTemporaryRamMigration + + ; + ; We store the TempRamTransitionData pointer in x19. By the + ; AArch64 calling convention we should normally save x19, but we + ; won't be returning to the caller, so we don't need to save it. + ; By the same rule, the TemporaryRamMigration PPI call should + ; preserve x19 for us. + ; + mov x19, x0 + + ; + ; Setup parameters and call TemporaryRamSupport->TemporaryRamMigration + ; (rcx) PeiServices + ; (rdx) TemporaryMemoryBase + ; (r8) PermanentMemoryBase + ; (r9) CopySize + ; + ldp x0, x1, [x19, 0x08] + ldp x2, x3, [x19, 0x18] + + ; + ; (x19) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION on stack + ; + ; Adjusted based on stack change made during + ; TemporaryRamSupport->TemporaryRamMigration call + ; + ldr x4, [x19] + mov x5, sp + sub x19, x19, x5 + blr x4 + mov x5, sp + add x19, x19, x5 + + ; + ; Setup parameters and call PeiTemporaryRamMigrated + ; (x0) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION + ; + mov x0, x19 + bl ASM_PFX(PeiTemporaryRamMigrated) + + END diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf b/MdeModulePkg/Core/Pei/PeiMain.inf index c8a6d5b80b..95ef7bb006 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.inf +++ b/MdeModulePkg/Core/Pei/PeiMain.inf @@ -47,6 +47,10 @@ PciCfg2/PciCfg2.c PeiMain.h +[Sources.AARCH64] + Dispatcher/AArch64/TemporaryRamMigration.asm | MSFT + Dispatcher/AArch64/TemporaryRamMigration.S | GCC + [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#38788): https://edk2.groups.io/g/devel/message/38788 Mute This Topic: https://groups.io/mt/31016928/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-