]>
Commit | Line | Data |
---|---|---|
949f388f | 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 | # Routine Description:\r | |
18 | #\r | |
d59326d3 | 19 | # Routine for switching stacks with 2 parameters EFI ABI\r |
949f388f | 20 | # Convert UNIX to EFI ABI\r |
21 | #\r | |
22 | # Arguments:\r | |
23 | #\r | |
24 | # (rdi) EntryPoint - Entry point with new stack.\r | |
25 | # (rsi) Context1 - Parameter1 for entry point. (rcx)\r | |
26 | # (rdx) Context2 - Parameter2 for entry point. (rdx) \r | |
d59326d3 | 27 | # (rcx) NewStack - The pointer to new stack.\r |
949f388f | 28 | #\r |
29 | # Returns:\r | |
30 | #\r | |
31 | # None\r | |
32 | #\r | |
33 | #------------------------------------------------------------------------------\r | |
34 | ASM_GLOBAL ASM_PFX(PeiSwitchStacks)\r | |
35 | ASM_PFX(PeiSwitchStacks):\r | |
36 | pushq $0 // tells gdb to stop unwinding frame\r | |
37 | movq %rsp, %rbp\r | |
38 | \r | |
d59326d3 | 39 | movq %rcx, %rsp // update stack pointer\r |
949f388f | 40 | \r |
d59326d3 | 41 | movq %rdi, %rax // entry point to %rax\r |
42 | movq %rsi, %rcx // Adjust Context1\r | |
43 | // Context2 already in the rigth spot\r | |
949f388f | 44 | \r |
45 | #\r | |
46 | # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,\r | |
47 | # in case the callee wishes to spill them.\r | |
48 | #\r | |
49 | subq $32, %rsp // 32-byte shadow space plus alignment pad\r | |
50 | call *%rax\r | |
51 | \r | |
52 | \r | |
53 | \r |