]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Sec/Ia32/Stack.S
Update the copyright notice format
[mirror_edk2.git] / OvmfPkg / Sec / Ia32 / Stack.S
CommitLineData
49ba9447 1#------------------------------------------------------------------------------\r
2#\r
56d7640a
HT
3# Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\r
4# This program and the accompanying materials\r
49ba9447 5# are licensed and made available under the terms and conditions of the BSD License\r
6# which accompanies this distribution. The full text of the license may be found at\r
7# http://opensource.org/licenses/bsd-license.php\r
8#\r
9# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11#\r
12# Module Name:\r
13#\r
14# Stack.asm\r
15#\r
16# Abstract:\r
17#\r
18# Switch the stack from temporary memory to permenent memory.\r
19#\r
20#------------------------------------------------------------------------------\r
21\r
22#------------------------------------------------------------------------------\r
23# VOID\r
24# EFIAPI\r
25# SecSwitchStack (\r
26# UINT32 TemporaryMemoryBase,\r
27# UINT32 PermenentMemoryBase\r
28# );\r
29#------------------------------------------------------------------------------ \r
30\r
31#include <ProcessorBind.h>\r
32\r
33ASM_GLOBAL ASM_PFX(SecSwitchStack)\r
34ASM_PFX(SecSwitchStack):\r
35#\r
36# Save three register: eax, ebx, ecx\r
37# \r
38 push %eax\r
39 push %ebx\r
40 push %ecx\r
41 push %edx\r
42 \r
43#\r
44# !!CAUTION!! this function address's is pushed into stack after\r
45# migration of whole temporary memory, so need save it to permenent\r
46# memory at first!\r
47# \r
48 \r
49 movl 20(%esp), %ebx # Save the first parameter\r
50 movl 24(%esp), %ecx # Save the second parameter\r
51 \r
52#\r
53# Save this function's return address into permenent memory at first.\r
54# Then, Fixup the esp point to permenent memory\r
55#\r
56\r
57 movl %esp, %eax\r
58 subl %ebx, %eax\r
59 addl %ecx, %eax\r
60 movl (%esp), %edx # copy pushed register's value to permenent memory\r
61 movl %edx, (%eax)\r
62 movl 4(%esp), %edx\r
63 movl %edx, 4(%eax)\r
64 movl 8(%esp), %edx\r
65 movl %edx, 8(%eax)\r
66 movl 12(%esp), %edx\r
67 movl %edx, 12(%eax)\r
68 movl 16(%esp), %edx\r
69 movl %edx, 16(%eax)\r
70 movl %eax, %esp # From now, esp is pointed to permenent memory\r
71\r
72#\r
73# Fixup the ebp point to permenent memory\r
74#\r
75 movl %ebp, %eax\r
76 subl %ebx, %eax\r
77 addl %ecx, %eax\r
78 movl %eax, %ebp # From now, ebp is pointed to permenent memory\r
79 \r
80#\r
81# Fixup callee's ebp point for PeiDispatch\r
82# \r
83 movl (%ebp), %eax\r
84 subl %ebx, %eax\r
85 addl %ecx, %eax\r
86 movl %eax, (%ebp) # From now, Temporary's PPI caller's stack is in permenent memory\r
87 \r
88 pop %edx\r
89 pop %ecx\r
90 pop %ebx\r
91 pop %eax\r
92 ret\r
93\r