]>
Commit | Line | Data |
---|---|---|
65e3f333 | 1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
e5dc7e71 | 3 | # Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r |
65e3f333 | 4 | # Portitions copyright (c) 2011, Apple Inc. All rights reserved.\r |
e3ba31da | 5 | # SPDX-License-Identifier: BSD-2-Clause-Patent\r |
65e3f333 | 6 | #\r |
7 | #------------------------------------------------------------------------------\r | |
8 | \r | |
9 | \r | |
10 | \r | |
11 | // EFI_STATUS\r | |
12 | // EFIAPI\r | |
13 | // SecTemporaryRamSupport (\r | |
14 | // IN CONST EFI_PEI_SERVICES **PeiServices, // %rcx\r | |
15 | // IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, // %rdx\r | |
d18d8a1d | 16 | // IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, // %r8\r |
65e3f333 | 17 | // IN UINTN CopySize // %r9\r |
18 | // )\r | |
19 | //\r | |
20 | ASM_GLOBAL ASM_PFX(SecTemporaryRamSupport)\r | |
21 | ASM_PFX(SecTemporaryRamSupport):\r | |
22 | // Adjust callers %rbp to account for stack move\r | |
23 | subq %rdx, %rbp // Calc offset of %rbp in Temp Memory\r | |
24 | addq %r8, %rbp // add in permanent base to offset\r | |
d18d8a1d | 25 | \r |
65e3f333 | 26 | pushq %rbp // stack frame is for the debugger\r |
27 | movq %rsp, %rbp\r | |
28 | \r | |
29 | pushq %rdx // Save TemporaryMemoryBase\r | |
30 | pushq %r8 // Save PermanentMemoryBase\r | |
31 | pushq %r9 // Save CopySize\r | |
e5dc7e71 | 32 | \r |
65e3f333 | 33 | //\r |
34 | // Copy all of temp RAM to permanent memory, including stack\r | |
35 | //\r | |
36 | // CopyMem (PermanentMemoryBase, TemporaryMemoryBase, CopySize);\r | |
37 | // %rcx, %rdx, %r8\r | |
38 | movq %r8, %rcx // Shift arguments\r | |
39 | movq %r9, %r8\r | |
e5dc7e71 | 40 | subq $0x28, %rsp // Allocate register spill area & 16-byte align stack\r |
65e3f333 | 41 | call ASM_PFX(CopyMem)\r |
42 | // Temp mem stack now copied to permanent location. %esp still in temp memory\r | |
e5dc7e71 | 43 | addq $0x28, %rsp\r |
44 | \r | |
65e3f333 | 45 | popq %r9 // CopySize (old stack)\r |
46 | popq %r8 // PermanentMemoryBase (old stack)\r | |
47 | popq %rdx // TemporaryMemoryBase (old stack)\r | |
d18d8a1d | 48 | \r |
65e3f333 | 49 | movq %rsp, %rcx // Move to new stack\r |
50 | subq %rdx, %rcx // Calc offset of stack in Temp Memory\r | |
51 | addq %r8, %rcx // Calc PermanentMemoryBase address\r | |
d18d8a1d | 52 | movq %rcx, %rsp // Update stack\r |
65e3f333 | 53 | // Stack now points to permanent memory\r |
d18d8a1d | 54 | \r |
65e3f333 | 55 | // ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);\r |
56 | movq %rdx, %rcx\r | |
57 | movq %r9, %rdx\r | |
e5dc7e71 | 58 | subq $0x28, %rsp // Allocate register spill area & 16-byte align stack\r |
65e3f333 | 59 | call ASM_PFX(ZeroMem)\r |
e5dc7e71 | 60 | addq $0x28, %rsp\r |
65e3f333 | 61 | \r |
62 | // This data comes off the NEW stack\r | |
63 | popq %rbp\r | |
64 | ret\r | |
65 | \r | |
66 | \r |