]>
Commit | Line | Data |
---|---|---|
6156fca1 | 1 | #------------------------------------------------------------------------------\r |
2 | #\r | |
7ee3b613 A |
3 | # OS X Application requires 16 byte stack alignment. The problem is these\r |
4 | # APIs are exposed to code that does not have this requirement via \r | |
5 | # EFI_UNIX_THUNK_PROTOCOL. So these are wrapper functions that make sure\r | |
6 | # the stack is aligned. This code should also work if the stack is already\r | |
7 | # aligned. Extra stack padding is really the same as local varaibles so \r | |
8 | # it gets freed by the leave instruction\r | |
9 | #\r | |
10 | # I basically used the compiler, added extra 16 bytes to the local stack and\r | |
11 | # made sure %esp ended in 0 before the call (16 byte algined)\r | |
12 | #\r | |
13 | # The EFI_UNIX_THUNK_PROTOCOL member functions call a C API that then calls \r | |
14 | # one of these generic assembly routines. We do it that way to work around \r | |
15 | # some magic name changing that happens in C. For example stat() is _stat() \r | |
16 | # on Leopard and _stat$INDOE64 on Snow Leopard. That is why we pass stat()\r | |
17 | # into one of these gaskets from C code.\r | |
18 | #\r | |
b9c8e50e | 19 | # Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r |
f9b8ab56 | 20 | # This program and the accompanying materials\r |
6156fca1 | 21 | # are licensed and made available under the terms and conditions of the BSD License\r |
22 | # which accompanies this distribution. The full text of the license may be found at\r | |
23 | # http://opensource.org/licenses/bsd-license.php\r | |
24 | #\r | |
25 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
26 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
27 | #\r | |
6156fca1 | 28 | #------------------------------------------------------------------------------\r |
29 | \r | |
5af06fe3 A |
30 | #ifdef __APPLE__\r |
31 | \r | |
6156fca1 | 32 | .text\r |
6156fca1 | 33 | \r |
6156fca1 | 34 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
35 | # int GasketVoid (void *api)\r |
36 | #------------------------------------------------------------------------------ \r | |
37 | .globl _GasketVoid\r | |
38 | _GasketVoid:\r | |
39 | pushl %ebp\r | |
40 | movl %esp, %ebp\r | |
41 | subl $34, %esp # sub extra 0x10 from the stack for the AND\r | |
42 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
43 | movl 8(%ebp), %eax\r | |
44 | movl %eax, -12(%ebp)\r | |
45 | movl -12(%ebp), %eax\r | |
46 | call *%eax\r | |
6156fca1 | 47 | leave\r |
48 | ret\r | |
49 | \r | |
6156fca1 | 50 | #------------------------------------------------------------------------------\r |
6156fca1 | 51 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
52 | .globl _GasketUintn\r |
53 | _GasketUintn:\r | |
54 | pushl %ebp\r | |
55 | movl %esp, %ebp\r | |
56 | subl $50, %esp # sub extra 0x10 from the stack for the AND\r | |
57 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
58 | movl 8(%ebp), %eax\r | |
59 | movl %eax, -12(%ebp)\r | |
60 | movl 12(%ebp), %eax\r | |
61 | movl %eax, (%esp)\r | |
62 | movl -12(%ebp), %eax\r | |
63 | call *%eax\r | |
64 | leave\r | |
65 | ret\r | |
6156fca1 | 66 | \r |
67 | #------------------------------------------------------------------------------\r | |
6156fca1 | 68 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
69 | .globl _GasketUintnUintn\r |
70 | _GasketUintnUintn:\r | |
71 | pushl %ebp\r | |
72 | movl %esp, %ebp\r | |
73 | subl $50, %esp # sub extra 0x10 from the stack for the AND \r | |
74 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
75 | movl 8(%ebp), %eax\r | |
76 | movl %eax, -12(%ebp)\r | |
77 | movl 16(%ebp), %eax\r | |
78 | movl %eax, 4(%esp)\r | |
79 | movl 12(%ebp), %eax\r | |
80 | movl %eax, (%esp)\r | |
81 | movl -12(%ebp), %eax\r | |
82 | call *%eax\r | |
83 | leave\r | |
84 | ret\r | |
6156fca1 | 85 | \r |
86 | #------------------------------------------------------------------------------\r | |
6156fca1 | 87 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
88 | .globl _GasketUintnUintnUintn\r |
89 | _GasketUintnUintnUintn:\r | |
90 | pushl %ebp\r | |
91 | movl %esp, %ebp\r | |
92 | subl $50, %esp # sub extra 0x10 from the stack for the AND\r | |
93 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
94 | movl 8(%ebp), %eax\r | |
95 | movl %eax, -12(%ebp)\r | |
96 | movl 20(%ebp), %eax\r | |
97 | movl %eax, 8(%esp)\r | |
98 | movl 16(%ebp), %eax\r | |
99 | movl %eax, 4(%esp)\r | |
100 | movl 12(%ebp), %eax\r | |
101 | movl %eax, (%esp)\r | |
102 | movl -12(%ebp), %eax\r | |
103 | call *%eax\r | |
104 | leave\r | |
105 | ret\r | |
6156fca1 | 106 | \r |
107 | #------------------------------------------------------------------------------\r | |
6156fca1 | 108 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
109 | .globl _GasketUintnUintnUintnUintn\r |
110 | _GasketUintnUintnUintnUintn:\r | |
111 | pushl %ebp\r | |
112 | movl %esp, %ebp\r | |
113 | subl $50, %esp # sub extra 0x10 from the stack for the AND\r | |
114 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
115 | movl 8(%ebp), %eax\r | |
116 | movl %eax, -12(%ebp)\r | |
117 | movl 24(%ebp), %eax\r | |
118 | movl %eax, 12(%esp)\r | |
119 | movl 20(%ebp), %eax\r | |
120 | movl %eax, 8(%esp)\r | |
121 | movl 16(%ebp), %eax\r | |
122 | movl %eax, 4(%esp)\r | |
123 | movl 12(%ebp), %eax\r | |
124 | movl %eax, (%esp)\r | |
125 | movl -12(%ebp), %eax\r | |
126 | call *%eax\r | |
127 | leave\r | |
128 | ret\r | |
6156fca1 | 129 | \r |
2ff79f2e | 130 | #------------------------------------------------------------------------------\r |
131 | #------------------------------------------------------------------------------\r | |
132 | .globl _GasketUintnUintnUintnUintnUintn\r | |
133 | _GasketUintnUintnUintnUintnUintn:\r | |
134 | pushl %ebp\r | |
135 | movl %esp, %ebp\r | |
136 | subl $50, %esp # sub extra 0x10 from the stack for the AND\r | |
137 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
138 | movl 8(%ebp), %eax\r | |
139 | movl %eax, -12(%ebp)\r | |
140 | movl 28(%ebp), %eax\r | |
141 | movl %eax, 16(%esp)\r | |
142 | movl 24(%ebp), %eax\r | |
143 | movl %eax, 12(%esp)\r | |
144 | movl 20(%ebp), %eax\r | |
145 | movl %eax, 8(%esp)\r | |
146 | movl 16(%ebp), %eax\r | |
147 | movl %eax, 4(%esp)\r | |
148 | movl 12(%ebp), %eax\r | |
149 | movl %eax, (%esp)\r | |
150 | movl -12(%ebp), %eax\r | |
151 | call *%eax\r | |
152 | leave\r | |
153 | ret\r | |
154 | \r | |
6156fca1 | 155 | #------------------------------------------------------------------------------\r |
6156fca1 | 156 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
157 | .globl _GasketUintn10Args\r |
158 | _GasketUintn10Args:\r | |
159 | pushl %ebp\r | |
160 | movl %esp, %ebp\r | |
161 | subl $82, %esp # sub extra 0x10 from the stack for the AND\r | |
162 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
163 | movl 8(%ebp), %eax \r | |
164 | movl %eax, -12(%ebp)\r | |
165 | movl 48(%ebp), %eax\r | |
166 | movl %eax, 36(%esp)\r | |
167 | movl 44(%ebp), %eax\r | |
168 | movl %eax, 32(%esp)\r | |
169 | movl 40(%ebp), %eax\r | |
170 | movl %eax, 28(%esp)\r | |
171 | movl 36(%ebp), %eax\r | |
172 | movl %eax, 24(%esp)\r | |
173 | movl 32(%ebp), %eax\r | |
174 | movl %eax, 20(%esp)\r | |
175 | movl 28(%ebp), %eax\r | |
176 | movl %eax, 16(%esp)\r | |
177 | movl 24(%ebp), %eax\r | |
178 | movl %eax, 12(%esp)\r | |
179 | movl 20(%ebp), %eax\r | |
180 | movl %eax, 8(%esp)\r | |
181 | movl 16(%ebp), %eax\r | |
182 | movl %eax, 4(%esp)\r | |
183 | movl 12(%ebp), %eax\r | |
184 | movl %eax, (%esp)\r | |
185 | movl -12(%ebp), %eax\r | |
186 | call *%eax\r | |
187 | leave\r | |
188 | ret\r | |
6156fca1 | 189 | \r |
6156fca1 | 190 | \r |
191 | #------------------------------------------------------------------------------\r | |
6156fca1 | 192 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
193 | .globl _GasketUint64Uintn\r |
194 | _GasketUint64Uintn:\r | |
195 | pushl %ebp\r | |
196 | movl %esp, %ebp\r | |
197 | subl $66, %esp # sub extra 0x10 from the stack for the AND\r | |
198 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
199 | movl 12(%ebp), %eax\r | |
200 | movl %eax, -32(%ebp)\r | |
201 | movl 16(%ebp), %eax\r | |
202 | movl %eax, -28(%ebp)\r | |
203 | movl 8(%ebp), %eax\r | |
204 | movl %eax, -12(%ebp)\r | |
205 | movl 20(%ebp), %eax\r | |
206 | movl %eax, 8(%esp)\r | |
207 | movl -32(%ebp), %eax\r | |
208 | movl -28(%ebp), %edx\r | |
209 | movl %eax, (%esp)\r | |
210 | movl %edx, 4(%esp)\r | |
211 | movl -12(%ebp), %eax\r | |
212 | call *%eax\r | |
213 | leave\r | |
214 | ret\r | |
6156fca1 | 215 | \r |
216 | #------------------------------------------------------------------------------\r | |
6156fca1 | 217 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
218 | .globl _GasketUintnUint64Uintn\r |
219 | _GasketUintnUint64Uintn:\r | |
220 | pushl %ebp\r | |
221 | movl %esp, %ebp\r | |
222 | subl $66, %esp # sub extra 0x10 from the stack for the AND\r | |
223 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
224 | movl 16(%ebp), %eax\r | |
225 | movl %eax, -32(%ebp)\r | |
226 | movl 20(%ebp), %eax\r | |
227 | movl %eax, -28(%ebp)\r | |
228 | movl 8(%ebp), %eax\r | |
229 | movl %eax, -12(%ebp)\r | |
230 | movl 24(%ebp), %eax\r | |
231 | movl %eax, 12(%esp)\r | |
232 | movl -32(%ebp), %eax\r | |
233 | movl -28(%ebp), %edx\r | |
234 | movl %eax, 4(%esp)\r | |
235 | movl %edx, 8(%esp)\r | |
236 | movl 12(%ebp), %eax\r | |
237 | movl %eax, (%esp)\r | |
238 | movl -12(%ebp), %eax\r | |
239 | call *%eax\r | |
6156fca1 | 240 | leave\r |
241 | ret\r | |
242 | \r | |
6156fca1 | 243 | #------------------------------------------------------------------------------\r |
6156fca1 | 244 | #------------------------------------------------------------------------------\r |
7ee3b613 A |
245 | .globl _GasketUintnUint16\r |
246 | _GasketUintnUint16:\r | |
247 | pushl %ebp\r | |
248 | movl %esp, %ebp\r | |
249 | subl $66, %esp # sub extra 0x10 from the stack for the AND\r | |
250 | and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r | |
251 | movl 16(%ebp), %eax\r | |
252 | movw %ax, -28(%ebp)\r | |
253 | movl 8(%ebp), %eax\r | |
254 | movl %eax, -12(%ebp)\r | |
255 | movzwl -28(%ebp), %eax\r | |
256 | movl %eax, 4(%esp)\r | |
257 | movl 12(%ebp), %eax\r | |
258 | movl %eax, (%esp)\r | |
259 | movl -12(%ebp), %eax\r | |
260 | call *%eax\r | |
261 | leave\r | |
262 | ret\r | |
2ec364f9 | 263 | \r |
264 | \r | |
b9c8e50e | 265 | .globl _ReverseGasketUint64\r |
266 | _ReverseGasketUint64:\r | |
2ac288f9 | 267 | pushl %ebp\r |
268 | movl %esp, %ebp\r | |
269 | subl $40, %esp\r | |
270 | movl 12(%ebp), %eax\r | |
271 | movl %eax, -16(%ebp)\r | |
272 | movl 16(%ebp), %eax\r | |
273 | movl %eax, -12(%ebp)\r | |
274 | movl -16(%ebp), %eax\r | |
275 | movl -12(%ebp), %edx\r | |
276 | movl %eax, (%esp)\r | |
277 | movl %edx, 4(%esp)\r | |
278 | movl 8(%ebp), %eax\r | |
279 | call *%eax\r | |
280 | leave\r | |
281 | ret\r | |
2ec364f9 | 282 | \r |
283 | \r | |
2ff79f2e | 284 | .globl _ReverseGasketUint64Uint64\r |
285 | _ReverseGasketUint64Uint64:\r | |
286 | pushl %ebp\r | |
287 | movl %esp, %ebp\r | |
288 | subl $56, %esp\r | |
289 | movl 12(%ebp), %eax\r | |
290 | movl %eax, -32(%ebp)\r | |
291 | movl 16(%ebp), %eax\r | |
292 | movl %eax, -28(%ebp)\r | |
293 | movl 20(%ebp), %eax\r | |
294 | movl %eax, -40(%ebp)\r | |
295 | movl 24(%ebp), %eax\r | |
296 | movl %eax, -36(%ebp)\r | |
297 | movl 8(%ebp), %eax\r | |
298 | movl %eax, -12(%ebp)\r | |
299 | movl -40(%ebp), %eax\r | |
300 | movl -36(%ebp), %edx\r | |
301 | movl %eax, 8(%esp)\r | |
302 | movl %edx, 12(%esp)\r | |
303 | movl -32(%ebp), %eax\r | |
304 | movl -28(%ebp), %edx\r | |
305 | movl %eax, (%esp)\r | |
306 | movl %edx, 4(%esp)\r | |
307 | movl -12(%ebp), %eax\r | |
308 | call *%eax\r | |
309 | leave\r | |
310 | ret\r | |
311 | \r | |
312 | \r | |
bb111c23 | 313 | // Sec PPI Callbacks\r |
314 | \r | |
315 | .globl _GasketSecUnixPeiLoadFile\r | |
316 | _GasketSecUnixPeiLoadFile:\r | |
2ac288f9 | 317 | jmp _SecUnixPeiLoadFile\r |
bb111c23 | 318 | \r |
319 | \r | |
320 | .globl _GasketSecUnixPeiAutoScan\r | |
321 | _GasketSecUnixPeiAutoScan:\r | |
2ac288f9 | 322 | jmp _SecUnixPeiAutoScan\r |
bb111c23 | 323 | \r |
324 | \r | |
325 | .globl _GasketSecUnixUnixThunkAddress\r | |
326 | _GasketSecUnixUnixThunkAddress:\r | |
2ac288f9 | 327 | jmp _SecUnixUnixThunkAddress\r |
bb111c23 | 328 | \r |
329 | \r | |
330 | .globl _GasketSecPeiReportStatusCode\r | |
331 | _GasketSecPeiReportStatusCode:\r | |
2ac288f9 | 332 | jmp _SecPeiReportStatusCode\r |
bb111c23 | 333 | \r |
334 | \r | |
335 | .globl _GasketSecUnixFdAddress\r | |
336 | _GasketSecUnixFdAddress:\r | |
2ac288f9 | 337 | jmp _SecUnixFdAddress\r |
bb111c23 | 338 | \r |
339 | \r | |
340 | .globl _GasketSecTemporaryRamSupport\r | |
341 | _GasketSecTemporaryRamSupport:\r | |
2ac288f9 | 342 | jmp _SecTemporaryRamSupport\r |
5af06fe3 A |
343 | \r |
344 | #endif\r |