]>
Commit | Line | Data |
---|---|---|
1 | #------------------------------------------------------------------------------\r | |
2 | #\r | |
3 | # Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
4 | # Portitions copyright (c) 2011, Apple Inc. All rights reserved.\r | |
5 | # This program and the accompanying materials\r | |
6 | # are licensed and made available under the terms and conditions of the BSD License\r | |
7 | # which accompanies this distribution. The full text of the license may be found at\r | |
8 | # http://opensource.org/licenses/bsd-license.php.\r | |
9 | #\r | |
10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | #\r | |
13 | #------------------------------------------------------------------------------\r | |
14 | \r | |
15 | \r | |
16 | \r | |
17 | // EFI_STATUS\r | |
18 | // EFIAPI\r | |
19 | // SecTemporaryRamSupport (\r | |
20 | // IN CONST EFI_PEI_SERVICES **PeiServices, // %rcx\r | |
21 | // IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, // %rdx\r | |
22 | // IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, // %r8 \r | |
23 | // IN UINTN CopySize // %r9\r | |
24 | // )\r | |
25 | //\r | |
26 | ASM_GLOBAL ASM_PFX(SecTemporaryRamSupport)\r | |
27 | ASM_PFX(SecTemporaryRamSupport):\r | |
28 | // Adjust callers %rbp to account for stack move\r | |
29 | subq %rdx, %rbp // Calc offset of %rbp in Temp Memory\r | |
30 | addq %r8, %rbp // add in permanent base to offset\r | |
31 | \r | |
32 | pushq %rbp // stack frame is for the debugger\r | |
33 | movq %rsp, %rbp\r | |
34 | \r | |
35 | pushq %rdx // Save TemporaryMemoryBase\r | |
36 | pushq %r8 // Save PermanentMemoryBase\r | |
37 | pushq %r9 // Save CopySize\r | |
38 | \r | |
39 | //\r | |
40 | // Copy all of temp RAM to permanent memory, including stack\r | |
41 | //\r | |
42 | // CopyMem (PermanentMemoryBase, TemporaryMemoryBase, CopySize);\r | |
43 | // %rcx, %rdx, %r8\r | |
44 | movq %r8, %rcx // Shift arguments\r | |
45 | movq %r9, %r8\r | |
46 | call ASM_PFX(CopyMem)\r | |
47 | // Temp mem stack now copied to permanent location. %esp still in temp memory\r | |
48 | \r | |
49 | popq %r9 // CopySize (old stack)\r | |
50 | popq %r8 // PermanentMemoryBase (old stack)\r | |
51 | popq %rdx // TemporaryMemoryBase (old stack)\r | |
52 | \r | |
53 | movq %rsp, %rcx // Move to new stack\r | |
54 | subq %rdx, %rcx // Calc offset of stack in Temp Memory\r | |
55 | addq %r8, %rcx // Calc PermanentMemoryBase address\r | |
56 | movq %rcx, %rsp // Update stack \r | |
57 | // Stack now points to permanent memory\r | |
58 | \r | |
59 | // ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);\r | |
60 | movq %rdx, %rcx\r | |
61 | movq %r9, %rdx\r | |
62 | call ASM_PFX(ZeroMem)\r | |
63 | \r | |
64 | // This data comes off the NEW stack\r | |
65 | popq %rbp\r | |
66 | ret\r | |
67 | \r | |
68 | \r |