]>
Commit | Line | Data |
---|---|---|
e148512e | 1 | ;------------------------------------------------------------------------------\r |
2 | ;\r | |
3 | ; Copyright (c) 2006 - 2012, 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 | EXTERN CopyMem:PROC\r | |
16 | EXTERN ZeroMem:PROC\r | |
17 | \r | |
18 | .code\r | |
19 | \r | |
20 | ;------------------------------------------------------------------------------\r | |
21 | ; EFI_STATUS\r | |
22 | ; EFIAPI\r | |
23 | ; SecTemporaryRamSupport (\r | |
24 | ; IN CONST EFI_PEI_SERVICES **PeiServices, // %rcx\r | |
25 | ; IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase, // %rdx\r | |
26 | ; IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, // %r8\r | |
27 | ; IN UINTN CopySize // %r9\r | |
28 | ; )\r | |
29 | ;------------------------------------------------------------------------------\r | |
30 | SecTemporaryRamSupport PROC\r | |
31 | ; Adjust callers %rbp to account for stack move\r | |
32 | sub rbp, rdx ; Calc offset of %rbp in Temp Memory\r | |
33 | add rbp, r8 ; add in permanent base to offset\r | |
34 | \r | |
35 | push rbp ; stack frame is for the debugger\r | |
36 | mov rbp, rsp\r | |
37 | \r | |
38 | push rdx ; Save TemporaryMemoryBase\r | |
39 | push r8 ; Save PermanentMemoryBase\r | |
40 | push r9 ; Save CopySize\r | |
41 | \r | |
42 | ;\r | |
43 | ; Copy all of temp RAM to permanent memory, including stack\r | |
44 | ;\r | |
45 | ; CopyMem (PermanentMemoryBase, TemporaryMemoryBase, CopySize);\r | |
46 | ; %rcx, %rdx, %r8\r | |
47 | mov rcx, r8 ; Shift arguments\r | |
48 | mov r8, r9\r | |
49 | sub rsp, 028h ; Allocate register spill area & 16-byte align stack\r | |
50 | call CopyMem\r | |
51 | ; Temp mem stack now copied to permanent location. %esp still in temp memory\r | |
52 | add rsp, 028h\r | |
53 | \r | |
54 | pop r9 ; CopySize (old stack)\r | |
55 | pop r8 ; PermanentMemoryBase (old stack)\r | |
56 | pop rdx ; TemporaryMemoryBase (old stack)\r | |
57 | \r | |
58 | mov rcx, rsp ; Move to new stack\r | |
59 | sub rcx, rdx ; Calc offset of stack in Temp Memory\r | |
60 | add rcx, r8 ; Calc PermanentMemoryBase address\r | |
61 | mov rsp, rcx ; Update stack\r | |
62 | ; Stack now points to permanent memory\r | |
63 | \r | |
64 | ; ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);\r | |
65 | mov rcx, rdx\r | |
66 | mov rdx, r9\r | |
67 | sub rsp, 028h ; Allocate register spill area & 16-byte align stack\r | |
68 | call ZeroMem\r | |
69 | add rsp, 028h\r | |
70 | \r | |
71 | ; This data comes off the NEW stack\r | |
72 | pop rbp\r | |
73 | ret\r | |
74 | SecTemporaryRamSupport ENDP\r | |
75 | \r | |
76 | END\r |