1 #------------------------------------------------------------------------------
3 # OS X Application requires 16 byte stack alignment. The problem is these
4 # APIs are exposed to code that does not have this requirement via
5 # EFI_UNIX_THUNK_PROTOCOL. So these are wrapper functions that make sure
6 # the stack is aligned. This code should also work if the stack is already
7 # aligned. Extra stack padding is really the same as local varaibles so
8 # it gets freed by the leave instruction
10 # I basically used the compiler, added extra 16 bytes to the local stack and
11 # made sure %esp ended in 0 before the call (16 byte algined)
13 # The EFI_UNIX_THUNK_PROTOCOL member functions call a C API that then calls
14 # one of these generic assembly routines. We do it that way to work around
15 # some magic name changing that happens in C. For example stat() is _stat()
16 # on Leopard and _stat$INDOE64 on Snow Leopard. That is why we pass stat()
17 # into one of these gaskets from C code.
19 # Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
20 # This program and the accompanying materials
21 # are licensed and made available under the terms and conditions of the BSD License
22 # which accompanies this distribution. The full text of the license may be found at
23 # http://opensource.org/licenses/bsd-license.php
25 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
26 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
28 #------------------------------------------------------------------------------
34 #------------------------------------------------------------------------------
35 # int GasketVoid (void *api)
36 #------------------------------------------------------------------------------
41 subl $34, %esp # sub extra 0x10 from the stack for the AND
42 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
50 #------------------------------------------------------------------------------
51 #------------------------------------------------------------------------------
56 subl $50, %esp # sub extra 0x10 from the stack for the AND
57 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
67 #------------------------------------------------------------------------------
68 #------------------------------------------------------------------------------
69 .globl _GasketUintnUintn
73 subl $50, %esp # sub extra 0x10 from the stack for the AND
74 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
86 #------------------------------------------------------------------------------
87 #------------------------------------------------------------------------------
88 .globl _GasketUintnUintnUintn
89 _GasketUintnUintnUintn:
92 subl $50, %esp # sub extra 0x10 from the stack for the AND
93 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
107 #------------------------------------------------------------------------------
108 #------------------------------------------------------------------------------
109 .globl _GasketUintnUintnUintnUintn
110 _GasketUintnUintnUintnUintn:
113 subl $50, %esp # sub extra 0x10 from the stack for the AND
114 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
130 #------------------------------------------------------------------------------
131 #------------------------------------------------------------------------------
132 .globl _GasketUintnUintnUintnUintnUintn
133 _GasketUintnUintnUintnUintnUintn:
136 subl $50, %esp # sub extra 0x10 from the stack for the AND
137 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
155 #------------------------------------------------------------------------------
156 #------------------------------------------------------------------------------
157 .globl _GasketUintn10Args
161 subl $82, %esp # sub extra 0x10 from the stack for the AND
162 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
191 #------------------------------------------------------------------------------
192 #------------------------------------------------------------------------------
193 .globl _GasketUint64Uintn
197 subl $66, %esp # sub extra 0x10 from the stack for the AND
198 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
216 #------------------------------------------------------------------------------
217 #------------------------------------------------------------------------------
218 .globl _GasketUintnUint64Uintn
219 _GasketUintnUint64Uintn:
222 subl $66, %esp # sub extra 0x10 from the stack for the AND
223 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
243 #------------------------------------------------------------------------------
244 #------------------------------------------------------------------------------
245 .globl _GasketUintnUint16
249 subl $66, %esp # sub extra 0x10 from the stack for the AND
250 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
255 movzwl -28(%ebp), %eax
265 .globl _ReverseGasketUint64
266 _ReverseGasketUint64:
284 .globl _ReverseGasketUint64Uint64
285 _ReverseGasketUint64Uint64:
315 .globl _GasketSecUnixPeiLoadFile
316 _GasketSecUnixPeiLoadFile:
317 jmp _SecUnixPeiLoadFile
320 .globl _GasketSecUnixPeiAutoScan
321 _GasketSecUnixPeiAutoScan:
322 jmp _SecUnixPeiAutoScan
325 .globl _GasketSecUnixUnixThunkAddress
326 _GasketSecUnixUnixThunkAddress:
327 jmp _SecUnixUnixThunkAddress
330 .globl _GasketSecPeiReportStatusCode
331 _GasketSecPeiReportStatusCode:
332 jmp _SecPeiReportStatusCode
335 .globl _GasketSecUnixFdAddress
336 _GasketSecUnixFdAddress:
337 jmp _SecUnixFdAddress
340 .globl _GasketSecTemporaryRamSupport
341 _GasketSecTemporaryRamSupport:
342 jmp _SecTemporaryRamSupport