--- /dev/null
+#------------------------------------------------------------------------------\r
+#\r
+# Copyright (c) 2008 - 2009 Apple Inc. All rights reserved.\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+# Abstract:\r
+#\r
+# OS X Application requires 16 byte stack alignment. The problem is these\r
+# APIs are exposed to code that does not have this requirement via \r
+# EFI_UNIX_THUNK_PROTOCOL. So these are wrapper functions that make sure\r
+# the stack is aligned. This code should also work if the stack is already\r
+# aligned. Extra stack padding is really the same as local varaibles so \r
+# it gets freed by the leave instruction\r
+#\r
+# I basically used the compiler, added extra 16 bytes to the local stack and\r
+# made sure %esp ended in 0 before the call (16 byte algined)\r
+#\r
+# cat t.c\r
+##include <stdio.h>\r
+##include <sys/stat.h>\r
+#\r
+#int chmod (int fd, mode_t len){\r
+# long m = (long)fd;\r
+#}\r
+#\r
+#int Gasketchmod (int fd, mode_t len){\r
+# return chmod (fd, len);\r
+#}\r
+#\r
+# gcc -S t.c\r
+# cat t.s\r
+# this gives you the starting point.... \r
+#\r
+#\r
+#------------------------------------------------------------------------------\r
+\r
+#include <ProcessorBind.h>\r
+\r
+ .text\r
+ \r
+#\r
+#\r
+# EFI_UNIX_THUNK_PROTOCOL that gets exported\r
+#\r
+#\r
+ \r
+#------------------------------------------------------------------------------\r
+# VOID GasketmsSleep (unsigned long Milliseconds);\r
+#------------------------------------------------------------------------------ \r
+.globl _GasketmsSleep\r
+_GasketmsSleep:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _msSleep\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# void Gasketexit (int status);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketexit\r
+_Gasketexit:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _exit\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# void GasketSetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));\r
+#------------------------------------------------------------------------------\r
+.globl _GasketSetTimer\r
+_GasketSetTimer:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, -16(%ebp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, -12(%ebp)\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl -16(%ebp), %eax\r
+ movl -12(%ebp), %edx\r
+ movl %eax, (%esp)\r
+ movl %edx, 4(%esp)\r
+ call _SetTimer\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# void GasketGetLocalTime (EFI_TIME *Time);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketGetLocalTime\r
+_GasketGetLocalTime:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _GetLocalTime\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# struct tm *Gasketgmtime (const time_t *clock);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketgmtime\r
+_Gasketgmtime:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _gmtime\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# long GasketGetTimeZone(void);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketGetTimeZone\r
+_GasketGetTimeZone:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $24, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ call _GetTimeZone\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int GasketGetDayLight (void);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketGetDayLight\r
+_GasketGetDayLight:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $24, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ call _GetDayLight\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketpoll (struct pollfd *pfd, int nfds, int timeout);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketpoll\r
+_Gasketpoll:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _poll\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketread (int fd, void *buf, int count);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketread\r
+_Gasketread:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _read\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketwrite (int fd, const void *buf, int count);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketwrite\r
+_Gasketwrite:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _write\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# char *Gasketgetenv (const char *name);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketgetenv\r
+_Gasketgetenv:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _getenv\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketopen (const char *name, int flags, int mode);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketopen\r
+_Gasketopen:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _open\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# off_t Gasketlseek (int fd, off_t off, int whence);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketlseek\r
+_Gasketlseek:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, -16(%ebp)\r
+ movl 16(%ebp), %eax\r
+ movl %eax, -12(%ebp)\r
+ movl 20(%ebp), %eax\r
+ movl %eax, 12(%esp)\r
+ movl -16(%ebp), %eax\r
+ movl -12(%ebp), %edx\r
+ movl %eax, 4(%esp)\r
+ movl %edx, 8(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _lseek\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketftruncate (int fd, long int len);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketftruncate\r
+_Gasketftruncate:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _truncate\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketclose (int fd);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketclose\r
+_Gasketclose:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _close\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketmkdir (const char *pathname, mode_t mode);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketmkdir\r
+_Gasketmkdir:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _mkdir\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketrmdir (const char *pathname);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketrmdir\r
+_Gasketrmdir:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _rmdir\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketunlink (const char *pathname);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketunlink\r
+_Gasketunlink:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _unlink\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int GasketGetErrno (void);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketGetErrno\r
+_GasketGetErrno:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $24, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ call _GetErrno\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# DIR *Gasketopendir (const char *pathname);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketopendir\r
+_Gasketopendir:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _opendir\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# void *Gasketrewinddir (DIR *dir);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketrewinddir\r
+_Gasketrewinddir:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _rewinddir\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# struct dirent *Gasketreaddir (DIR *dir);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketreaddir\r
+_Gasketreaddir:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _readdir\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketclosedir (DIR *dir);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketclosedir\r
+_Gasketclosedir:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _closedir\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketstat (const char *path, struct stat *buf);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketstat\r
+_Gasketstat:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _stat\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketstatfs (const char *path, struct statfs *buf);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketstatfs\r
+_Gasketstatfs:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _statfs\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketrename (const char *oldpath, const char *newpath);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketrename\r
+_Gasketrename:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _rename\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# time_t Gasketmktime (struct tm *tm);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketmktime\r
+_Gasketmktime:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _mktime\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketfsync (int fd);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketfsync\r
+_Gasketfsync:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _fsync\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketchmod (const char *path, mode_t mode);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketchmod\r
+_Gasketchmod:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $56, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movw %ax, -12(%ebp)\r
+ movzwl -12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _chmod\r
+ leave\r
+ ret\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketutime (const char *filename, const struct utimbuf *buf);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketutime\r
+_Gasketutime:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _rename\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gaskettcflush (int fildes, int queue_selector);\r
+#------------------------------------------------------------------------------\r
+.globl _Gaskettcflush\r
+_Gaskettcflush:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _rename\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# EFI_STATUS UgaCreate (struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketUgaCreate\r
+_GasketUgaCreate:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp #sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _UgaCreate\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# void Gasketperror (__const char *__s);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketperror\r
+_Gasketperror:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _perror\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketioctl (int fd, unsigned long int __request, ...);\r
+#\r
+# ... is really int or pointer to structure, so we can treat like an int\r
+#\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketioctl\r
+_Gasketioctl:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _ioctl\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketfcntl (int __fd, int __cmd, ...);\r
+#\r
+# ... is really int or pointer to structure, so we can treat like an int\r
+#\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketfcntl\r
+_Gasketfcntl:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _fcntl\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketcfsetispeed (struct termios *__termios_p, speed_t __speed);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketcfsetispeed\r
+_Gasketcfsetispeed:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _cfsetispeed\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketcfsetospeed (struct termios *__termios_p, speed_t __speed);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketcfsetospeed\r
+_Gasketcfsetospeed:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _cfsetospeed\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gaskettcgetattr (int __fd, struct termios *__termios_p); \r
+#------------------------------------------------------------------------------\r
+.globl _Gaskettcgetattr\r
+_Gaskettcgetattr:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _tcgetattr\r
+ leave\r
+ ret\r
+\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gaskettcsetattr (int __fd, int __optional_actions, __const struct termios *__termios_p);\r
+#------------------------------------------------------------------------------\r
+.globl _Gaskettcsetattr\r
+_Gaskettcsetattr:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _tcsetattr\r
+ leave\r
+ ret\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketsigaction (int sig, const struct sigaction *act, struct sigaction *oact);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketsigaction\r
+_Gasketsigaction:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _sigaction\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketsetcontext (const ucontext_t *ucp);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketsetcontext\r
+_Gasketsetcontext:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _setcontext\r
+ leave\r
+ ret\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketgetcontext (ucontext_t *ucp);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketgetcontext\r
+_Gasketgetcontext:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _getcontext\r
+ leave\r
+ ret\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketsigemptyset (sigset_t *set);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketsigemptyset\r
+_Gasketsigemptyset:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _sigemptyset\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# int Gasketsigaltstack (const stack_t *ss, stack_t *oss);\r
+#------------------------------------------------------------------------------\r
+.globl _Gasketsigaltstack\r
+_Gasketsigaltstack:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _sigaltstack\r
+ leave\r
+ ret\r
+\r
+#\r
+#\r
+# UGA Functions that get exported\r
+#\r
+#\r
+\r
+#------------------------------------------------------------------------------\r
+# EFI_STATUS GasketUgaClose (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo);\r
+#------------------------------------------------------------------------------ \r
+.globl _GasketUgaClose\r
+_GasketUgaClose:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _UgaClose\r
+ leave\r
+ ret\r
+\r
+#------------------------------------------------------------------------------\r
+# EFI_STATUS GasketUgaSize (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, UINT32 Width, UINT32 Height);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketUgaSize\r
+_GasketUgaSize:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _UgaSize\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# EFI_STATUS GasketUgaCheckKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo);\r
+#------------------------------------------------------------------------------ \r
+.globl _GasketUgaCheckKey\r
+_GasketUgaCheckKey:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp # sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _UgaCheckKey\r
+ leave\r
+ ret\r
+\r
+#------------------------------------------------------------------------------\r
+# EFI_STATUS GasketUgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_INPUT_KEY *key);\r
+#------------------------------------------------------------------------------\r
+.globl _GasketUgaGetKey\r
+_GasketUgaGetKey:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $40, %esp #sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _UgaGetKey\r
+ leave\r
+ ret\r
+\r
+\r
+#------------------------------------------------------------------------------\r
+# EFI_STATUS\r
+# GasketUgaBlt(\r
+# EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,\r
+# IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,\r
+# IN EFI_UGA_BLT_OPERATION BltOperation,\r
+# IN UINTN SourceX,\r
+# IN UINTN SourceY,\r
+# IN UINTN DestinationX,\r
+# IN UINTN DestinationY,\r
+# IN UINTN Width,\r
+# IN UINTN Height,\r
+# IN UINTN Delta OPTIONAL\r
+# );\r
+#------------------------------------------------------------------------------\r
+.globl _GasketUgaBlt\r
+_GasketUgaBlt:\r
+ pushl %ebp\r
+ movl %esp, %ebp\r
+ subl $88, %esp #sub extra 0x10 from the stack for the AND\r
+ and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call\r
+ movl $0, -12(%ebp)\r
+ movl 44(%ebp), %eax\r
+ movl %eax, 36(%esp)\r
+ movl 40(%ebp), %eax\r
+ movl %eax, 32(%esp)\r
+ movl 36(%ebp), %eax\r
+ movl %eax, 28(%esp)\r
+ movl 32(%ebp), %eax\r
+ movl %eax, 24(%esp)\r
+ movl 28(%ebp), %eax\r
+ movl %eax, 20(%esp)\r
+ movl 24(%ebp), %eax\r
+ movl %eax, 16(%esp)\r
+ movl 20(%ebp), %eax\r
+ movl %eax, 12(%esp)\r
+ movl 16(%ebp), %eax\r
+ movl %eax, 8(%esp)\r
+ movl 12(%ebp), %eax\r
+ movl %eax, 4(%esp)\r
+ movl 8(%ebp), %eax\r
+ movl %eax, (%esp)\r
+ call _UgaBlt\r
+ leave\r
+ ret\r
+\r