1 #------------------------------------------------------------------------------
3 # Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 # This is separated from processor.c to allow this functions to be built with /O1
19 #------------------------------------------------------------------------------
24 .globl ASM_PFX(SwitchStacks)
25 .globl ASM_PFX(TransferControlSetJump)
26 .globl ASM_PFX(TransferControlLongJump)
29 # Routine Description:
30 # This allows the caller to switch the stack and goes to the new entry point
33 # EntryPoint - Pointer to the location to enter // rcx
34 # Parameter - Parameter to pass in // rdx
35 # NewStack - New Location of the stack // r8
36 # NewBsp - New BSP // r9 - not used
39 # Nothing. Goes to the Entry Point passing in the new parameters
41 ASM_PFX(SwitchStacks):
44 # 1) leave 4 registers space
45 # 2) let it 16 bytes aligned after call
47 and -0x10,%r8w # do not assume 16 bytes aligned
55 # no ret as we have a new stack and we jumped to the new location
63 .equ EFI_WARN_RETURN_FROM_LONG_JUMP, 5
68 # This routine implements the x64 variant of the SetJump call. Its
69 # responsibility is to store system state information for a possible
70 # subsequent LongJump.
74 # Pointer to CPU context save buffer.
82 # TransferControlLongJump (
83 # IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
84 # IN EFI_JUMP_BUFFER *Jump
90 ASM_PFX(TransferControlSetJump):
102 #; save non-volatile fp registers
106 movdqu %xmm7, 0x10(%rax)
107 movdqu %xmm8, 0x20(%rax)
108 movdqu %xmm9, 0x30(%rax)
109 movdqu %xmm10, 0x40(%rax)
110 movdqu %xmm11, 0x50(%rax)
111 movdqu %xmm12, 0x60(%rax)
112 movdqu %xmm13, 0x70(%rax)
113 movdqu %xmm14, 0x80(%rax)
114 movdqu %xmm15, 0x90(%rax)
124 # TransferControlLongJump (
125 # IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This, // rcx
126 # IN EFI_JUMP_BUFFER *Jump // rdx
130 ASM_PFX(TransferControlLongJump):
131 # set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
132 #; load non-volatile fp registers
136 movdqu 0x10(%rax), %xmm7
137 movdqu 0x20(%rax), %xmm8
138 movdqu 0x30(%rax), %xmm9
139 movdqu 0x40(%rax), %xmm10
140 movdqu 0x50(%rax), %xmm11
141 movdqu 0x60(%rax), %xmm12
142 movdqu 0x70(%rax), %xmm13
143 movdqu 0x80(%rax), %xmm14
144 movdqu 0x90(%rax), %xmm15