]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add Sec/Ia32/Gasket.S
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 25 Aug 2009 07:39:51 +0000 (07:39 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 25 Aug 2009 07:39:51 +0000 (07:39 +0000)
Remove unreferenced Stack.S

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9195 6f19259b-4bc3-4df7-8a09-765794883524

UnixPkg/Sec/Ia32/Gasket.S [new file with mode: 0644]
UnixPkg/Sec/Stack.S [deleted file]

diff --git a/UnixPkg/Sec/Ia32/Gasket.S b/UnixPkg/Sec/Ia32/Gasket.S
new file mode 100644 (file)
index 0000000..80d0336
--- /dev/null
@@ -0,0 +1,983 @@
+#------------------------------------------------------------------------------\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
diff --git a/UnixPkg/Sec/Stack.S b/UnixPkg/Sec/Stack.S
deleted file mode 100644 (file)
index ae9fe9b..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2008, Intel Corporation\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
-# Module Name:\r
-#\r
-#   Stack.asm\r
-#\r
-# Abstract:\r
-#\r
-#   Switch the stack from temporary memory to permenent memory.\r
-#\r
-#------------------------------------------------------------------------------\r
-\r
-#------------------------------------------------------------------------------\r
-# VOID\r
-# EFIAPI\r
-# SecSwitchStack (\r
-#   UINT32   TemporaryMemoryBase,\r
-#   UINT32   PermenentMemoryBase\r
-#   );\r
-#------------------------------------------------------------------------------    \r
-\r
-#include <ProcessorBind.h>\r
-\r
-ASM_GLOBAL ASM_PFX(SecSwitchStack)\r
-ASM_PFX(SecSwitchStack):\r
-#\r
-# Save three register: eax, ebx, ecx\r
-#    \r
-    push  %eax\r
-    push  %ebx\r
-    push  %ecx\r
-    push  %edx\r
-    \r
-#\r
-# !!CAUTION!! this function address's is pushed into stack after\r
-# migration of whole temporary memory, so need save it to permenent\r
-# memory at first!\r
-#    \r
-    \r
-    movl  20(%esp), %ebx            # Save the first parameter\r
-    movl  24(%esp), %ecx            # Save the second parameter\r
-    \r
-#\r
-# Save this function's return address into permenent memory at first.\r
-# Then, Fixup the esp point to permenent memory\r
-#\r
-\r
-    movl  %esp, %eax\r
-    subl  %ebx, %eax\r
-    addl  %ecx, %eax\r
-    movl  (%esp), %edx                 # copy pushed register's value to permenent memory\r
-    movl  %edx, (%eax)\r
-    movl  4(%esp), %edx\r
-    movl  %edx, 4(%eax)\r
-    movl  8(%esp), %edx\r
-    movl  %edx, 8(%eax)\r
-    movl  12(%esp), %edx\r
-    movl  %edx, 12(%eax)\r
-    movl  16(%esp), %edx\r
-    movl  %edx, 16(%eax)\r
-    movl  %eax, %esp                   # From now, esp is pointed to permenent memory\r
-\r
-#\r
-# Fixup the ebp point to permenent memory\r
-#\r
-    movl   %ebp, %eax\r
-    subl   %ebx, %eax\r
-    addl   %ecx, %eax\r
-    movl   %eax, %ebp                  # From now, ebp is pointed to permenent memory\r
-    \r
-#\r
-# Fixup callee's ebp point for PeiDispatch\r
-#    \r
-    movl   (%ebp), %eax\r
-    subl   %ebx, %eax\r
-    addl   %ecx, %eax\r
-    movl   %eax, (%ebp)                # From now, Temporary's PPI caller's stack is in permenent memory\r
-    \r
-    pop   %edx\r
-    pop   %ecx\r
-    pop   %ebx\r
-    pop   %eax\r
-    ret\r