Signed-off-by: Jordan Justen <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
---
.../Dispatcher/Arm/TemporaryRamMigration.S | 68 +++++++++++++++++++
.../Dispatcher/Arm/TemporaryRamMigration.asm | 68 +++++++++++++++++++
MdeModulePkg/Core/Pei/PeiMain.inf | 5 ++
3 files changed, 141 insertions(+)
create mode 100644 MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.S
create mode 100644
MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.asm
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.S
b/MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.S
new file mode 100644
index 0000000000..872bbcf27d
--- /dev/null
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.S
@@ -0,0 +1,68 @@
+#------------------------------------------------------------------------------
+#
+# 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] r0 Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION
+#
+# @return None This routine does not return
+#------------------------------------------------------------------------------
+ASM_PFX(PeiTemporaryRamMigration):
+
+ #
+ # We store the TempRamTransitionData pointer in r6. By the
+ # Arm calling convention we should normally save r6, 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 r6 for us.
+ #
+ mov r6, r0
+
+ #
+ # Setup parameters and call TemporaryRamSupport->TemporaryRamMigration
+ # (r0) PeiServices
+ # (r2,r3) TemporaryMemoryBase
+ # (stack) PermanentMemoryBase
+ # (stack) CopySize
+ #
+ add r7, r6, #4
+ ldmia r7, {r0-r5}
+ stmfd sp!, {r3, r4, r5}
+ mov r3, r2
+ mov r2, r1
+
+ #
+ # (r6) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION on stack
+ #
+ # Adjusted based on stack change made during
+ # TemporaryRamSupport->TemporaryRamMigration call
+ #
+ ldr r4, [r6]
+ mov r5, sp
+ sub r6, r6, r5
+ mov lr, pc
+ bx r4
+ mov r0, sp
+ add r6, r6, r0
+ add sp, sp, #0xc
+
+ #
+ # Setup parameters and call PeiTemporaryRamMigrated
+ # (r0) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION
+ #
+ mov r0, r6
+ bl ASM_PFX(PeiTemporaryRamMigrated)
diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.asm
b/MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.asm
new file mode 100644
index 0000000000..1cfb0e0dd8
--- /dev/null
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Arm/TemporaryRamMigration.asm
@@ -0,0 +1,68 @@
+;------------------------------------------------------------------------------
+;
+; 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] r0 Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION
+;
+; @return None This routine does not return
+;------------------------------------------------------------------------------
+PeiTemporaryRamMigration
+
+ ;
+ ; We store the TempRamTransitionData pointer in r6. By the
+ ; Arm calling convention we should normally save r6, 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 r6 for us.
+ ;
+ mov r6, r0
+
+ ;
+ ; Setup parameters and call TemporaryRamSupport->TemporaryRamMigration
+ ; (r0) PeiServices
+ ; (r2,r3) TemporaryMemoryBase
+ ; (stack) PermanentMemoryBase
+ ; (stack) CopySize
+ ;
+ add r7, r6, #4
+ ldmia r7, {r0-r5}
+ stmfd sp!, {r3, r4, r5}
+ mov r3, r2
+ mov r2, r1
+
+ ;
+ ; (r6) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION on stack
+ ;
+ ; Adjusted based on stack change made during
+ ; TemporaryRamSupport->TemporaryRamMigration call
+ ;
+ ldr r4, [r6]
+ mov r5, sp
+ sub r6, r6, r5
+ mov lr, pc
+ bx r4
+ mov r0, sp
+ add r6, r6, r0
+ add sp, sp, #0xc
+
+ ;
+ ; Setup parameters and call PeiTemporaryRamMigrated
+ ; (r0) Pointer to PEI_CORE_TEMPORARY_RAM_TRANSITION
+ ;
+ mov r0, r6
+ bl ASM_PFX(PeiTemporaryRamMigrated)
+
+ END
diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf
b/MdeModulePkg/Core/Pei/PeiMain.inf
index 95ef7bb006..1be898bb91 100644
--- a/MdeModulePkg/Core/Pei/PeiMain.inf
+++ b/MdeModulePkg/Core/Pei/PeiMain.inf
@@ -51,6 +51,11 @@
Dispatcher/AArch64/TemporaryRamMigration.asm | MSFT
Dispatcher/AArch64/TemporaryRamMigration.S | GCC
+[Sources.ARM]
+ Dispatcher/Arm/TemporaryRamMigration.asm | RVCT
+ Dispatcher/Arm/TemporaryRamMigration.asm | MSFT
+ Dispatcher/Arm/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 (#38787): https://edk2.groups.io/g/devel/message/38787
Mute This Topic: https://groups.io/mt/31016926/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-