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 - 2009 Apple Inc. All rights reserved.
20 # All rights reserved. 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 #------------------------------------------------------------------------------
32 #------------------------------------------------------------------------------
33 # int GasketVoid (void *api)
34 #------------------------------------------------------------------------------
39 subl $34, %esp # sub extra 0x10 from the stack for the AND
40 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
48 #------------------------------------------------------------------------------
49 #------------------------------------------------------------------------------
54 subl $50, %esp # sub extra 0x10 from the stack for the AND
55 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
65 #------------------------------------------------------------------------------
66 #------------------------------------------------------------------------------
67 .globl _GasketUintnUintn
71 subl $50, %esp # sub extra 0x10 from the stack for the AND
72 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
84 #------------------------------------------------------------------------------
85 #------------------------------------------------------------------------------
86 .globl _GasketUintnUintnUintn
87 _GasketUintnUintnUintn:
90 subl $50, %esp # sub extra 0x10 from the stack for the AND
91 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
105 #------------------------------------------------------------------------------
106 #------------------------------------------------------------------------------
107 .globl _GasketUintnUintnUintnUintn
108 _GasketUintnUintnUintnUintn:
111 subl $50, %esp # sub extra 0x10 from the stack for the AND
112 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
128 #------------------------------------------------------------------------------
129 #------------------------------------------------------------------------------
130 .globl _GasketUintn10Args
134 subl $82, %esp # sub extra 0x10 from the stack for the AND
135 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
164 #------------------------------------------------------------------------------
165 #------------------------------------------------------------------------------
166 .globl _GasketUint64Uintn
170 subl $66, %esp # sub extra 0x10 from the stack for the AND
171 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
189 #------------------------------------------------------------------------------
190 #------------------------------------------------------------------------------
191 .globl _GasketUintnUint64Uintn
192 _GasketUintnUint64Uintn:
195 subl $66, %esp # sub extra 0x10 from the stack for the AND
196 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
216 #------------------------------------------------------------------------------
217 #------------------------------------------------------------------------------
218 .globl _GasketUintnUint16
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
228 movzwl -28(%ebp), %eax
237 .subsections_via_symbols