]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Sec/X64/SwitchRam.S
EmulatorPkg: Remove all trailing whitespace
[mirror_edk2.git] / EmulatorPkg / Sec / X64 / SwitchRam.S
CommitLineData
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
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
d18d8a1d 22// IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase, // %r8\r
65e3f333 23// IN UINTN CopySize // %r9\r
24// )\r
25//\r
26ASM_GLOBAL ASM_PFX(SecTemporaryRamSupport)\r
27ASM_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
d18d8a1d 31\r
65e3f333 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
e5dc7e71 38\r
65e3f333 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
e5dc7e71 46 subq $0x28, %rsp // Allocate register spill area & 16-byte align stack\r
65e3f333 47 call ASM_PFX(CopyMem)\r
48 // Temp mem stack now copied to permanent location. %esp still in temp memory\r
e5dc7e71 49 addq $0x28, %rsp\r
50\r
65e3f333 51 popq %r9 // CopySize (old stack)\r
52 popq %r8 // PermanentMemoryBase (old stack)\r
53 popq %rdx // TemporaryMemoryBase (old stack)\r
d18d8a1d 54\r
65e3f333 55 movq %rsp, %rcx // Move to new stack\r
56 subq %rdx, %rcx // Calc offset of stack in Temp Memory\r
57 addq %r8, %rcx // Calc PermanentMemoryBase address\r
d18d8a1d 58 movq %rcx, %rsp // Update stack\r
65e3f333 59 // Stack now points to permanent memory\r
d18d8a1d 60\r
65e3f333 61 // ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);\r
62 movq %rdx, %rcx\r
63 movq %r9, %rdx\r
e5dc7e71 64 subq $0x28, %rsp // Allocate register spill area & 16-byte align stack\r
65e3f333 65 call ASM_PFX(ZeroMem)\r
e5dc7e71 66 addq $0x28, %rsp\r
65e3f333 67\r
68 // This data comes off the NEW stack\r
69 popq %rbp\r
70 ret\r
71\r
72\r