diff --git a/UnixPkg/Sec/Ia32/GasketTemplate.c b/UnixPkg/Sec/Ia32/GasketTemplate.c deleted file mode 100644 index d85a26a53e..0000000000 --- a/UnixPkg/Sec/Ia32/GasketTemplate.c +++ /dev/null @@ -1,163 +0,0 @@ -/** @file - Template file used to create Gasket.S - - This file is built on the command line via gcc GasketTemplate.c -S - and it will create GasketTemplate.s and this was used to create - Gasket.S. You still have to add the extra stack alignment code to - the assembly functions. - -Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
-Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - - -#include -#include - -typedef int8_t INT8; -typedef uint8_t UINT8; -typedef int16_t INT16; -typedef uint16_t UINT16; -typedef int32_t INT32; -typedef uint32_t UINT32; -typedef int64_t INT64; -typedef uint64_t UINT64; -typedef UINT32 UINTN; - - -typedef int (*GASKET_VOID) (); -typedef int (*GASKET_UINTN) (UINTN); -typedef int (*GASKET_UINT64) (UINT64); -typedef int (*GASKET_UINT64UINT64) (UINT64, UINT64); -typedef int (*GASKET_UINTN_UINTN) (UINTN, UINTN); -typedef int (*GASKET_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN); -typedef int (*GASKET_UINTN_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN, UINTN); -typedef int (*GASKET_UINTN_10ARGS) (UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN); -typedef int (*GASKET_UINT64_UINTN) (UINT64, UINTN); -typedef UINT64 (*GASKET_UINTN_UINT64_UINTN) (UINTN, UINT64, UINTN); -typedef int (*GASKET_UINTN_UINT16) (UINTN, UINT16); - -int GasketVoid (void *api); -int GasketUintn (void *api, UINTN a); -int GasketUintnUintn (void *api, UINTN a, UINTN b); -int GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c); -int GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d); -int GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j); -int GasketUint64Uintn (void *api, UINT64 a, UINTN b); -UINT64 GasketUintnUiny64Uintn (void *api, UINTN a, UINT64 b, UINTN c); -int GasketUintnUint16 (void *api, UINTN a, UINT16 b); - - - -int -GasketVoid (void *api) -{ - GASKET_VOID func; - - func = (GASKET_VOID)api; - return func (); -} - -int -GasketUintn (void *api, UINTN a) -{ - GASKET_UINTN func; - - func = (GASKET_UINTN)api; - return func (a); -} - -int -GasketUintnUintn (void *api, UINTN a, UINTN b) -{ - GASKET_UINTN_UINTN func; - - func = (GASKET_UINTN_UINTN)api; - return func (a, b); -} - - -int -GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c) -{ - GASKET_UINTN_UINTN_UINTN func; - - func = (GASKET_UINTN_UINTN_UINTN)api; - return func (a, b, c); -} - -int -GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d) -{ - GASKET_UINTN_UINTN_UINTN_UINTN func; - - func = (GASKET_UINTN_UINTN_UINTN_UINTN)api; - return func (a, b, c, d); -} - -int -GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j) -{ - GASKET_UINTN_10ARGS func; - - func = (GASKET_UINTN_10ARGS)api; - return func (a, b, c, d, e, f, g, h, i, j); -} - - -int -GasketUint64Uintn (void *api, UINT64 a, UINTN b) -{ - GASKET_UINT64_UINTN func; - - func = (GASKET_UINT64_UINTN)api; - return func (a, b); -} - -UINT64 -GasketUintnUint64Uintn (void *api, UINTN a, UINT64 b, UINTN c) -{ - GASKET_UINTN_UINT64_UINTN func; - - func = (GASKET_UINTN_UINT64_UINTN)api; - return func (a, b, c); -} - -int -GasketUintnUint16 (void *api, UINTN a, UINT16 b) -{ - GASKET_UINTN_UINT16 func; - - func = (GASKET_UINTN_UINT16)api; - return func (a, b); -} - -void -ReverseGasketUint64 (void *api, UINT64 a) -{ - GASKET_UINTN func; - - func = (GASKET_UINT64)api; - func (a); - return; -} - -void -ReverseGasketUint64UINT64 (void *api, UINT64 a, UINT64 b) -{ - GASKET_UINT64UINT64 func; - - func = (GASKET_UINT64UINT64)api; - func (a, b); - return; -} - - diff --git a/UnixPkg/Sec/X64/GasketEfiTemplate.c b/UnixPkg/Sec/X64/GasketEfiTemplate.c deleted file mode 100644 index c9fc748f5e..0000000000 --- a/UnixPkg/Sec/X64/GasketEfiTemplate.c +++ /dev/null @@ -1,411 +0,0 @@ -/** @file - - Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BSD License - which accompanies this distribution. The full text of the license may be found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include "SecMain.h" -#include "Gasket.h" - -// -// OS X Posix does some strange name mangling on these names in C. -// If you call from assembler you get the wrong version of the function -// So these globals get you the correct name mangled functions that can -// be accessed from assembly -// -extern UnixRmDir gUnixRmDir; -extern UnixOpenDir gUnixOpenDir; -extern UnixStat gUnixStat; -extern UnixStatFs gUnixStatFs; - -// -// Gasket functions for EFI_UNIX_THUNK_PROTOCOL -// - -int -Gasketrmdir (const char *pathname) -{ - return gUnixRmDir (pathname); -} - - -DIR * -Gasketopendir (const char *pathname) -{ - return gUnixOpenDir (pathname); -} - - -int -Gasketstat (const char *path, STAT_FIX *buf) -{ - return gUnixStat (path, buf); -} - - -int -Gasketstatfs (const char *path, struct statfs *buf) -{ - return gUnixStatFs (path, buf); -} - -///// - - -void -GasketmsSleep (unsigned long Milliseconds) -{ - msSleep (Milliseconds); - return; -} - -void -Gasketexit (int status) -{ - exit (status); - return; -} - - -void -GasketSetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)) -{ - SetTimer (PeriodMs, CallBack); - return; -} - - -void -GasketGetLocalTime (EFI_TIME *Time) -{ - GetLocalTime (Time); - return; -} - - -struct tm * -Gasketgmtime (const time_t *clock) -{ - return localtime (clock); -} - - -long -GasketGetTimeZone (void) -{ - return GetTimeZone (); -} - - -int -GasketGetDayLight (void) -{ - return GetDayLight (); -} - - -int -Gasketpoll (struct pollfd *pfd, unsigned int nfds, int timeout) -{ - return poll (pfd, nfds, timeout); -} - - -long -Gasketread (int fd, void *buf, int count) -{ - return read (fd, buf, count); -} - - -long -Gasketwrite (int fd, const void *buf, int count) -{ - return write (fd, buf, count); -} - - -char * -Gasketgetenv (const char *name) -{ - return getenv (name); -} - - -int -Gasketopen (const char *name, int flags, int mode) -{ - return open (name, flags, mode); -} - - -off_t -Gasketlseek (int fd, off_t off, int whence) -{ - return lseek (fd, off, whence); -} - - -int -Gasketftruncate (int fd, long int len) -{ - return ftruncate (fd, len); -} - - -int -Gasketclose (int fd) -{ - return close (fd); -} - - -int -Gasketmkdir (const char *pathname, mode_t mode) -{ - return mkdir (pathname, mode); -} - - -int -Gasketunlink (const char *pathname) -{ - return unlink (pathname); -} - - -int -GasketGetErrno (void) -{ - return GetErrno (); -} - - -void -Gasketrewinddir (DIR *dir) -{ - rewinddir (dir); - return; -} - - -struct dirent * -Gasketreaddir (DIR *dir) -{ - return readdir (dir); -} - - -int -Gasketclosedir (DIR *dir) -{ - return closedir (dir); -} - - -int -Gasketrename (const char *oldpath, const char *newpath) -{ - return rename (oldpath, newpath); -} - - -time_t -Gasketmktime (struct tm *tm) -{ - return mktime (tm); -} - - -int -Gasketfsync (int fd) -{ - return fsync (fd); -} - - -int -Gasketchmod (const char *path, mode_t mode) -{ - return chmod (path, mode); -} - - -int -Gasketutime (const char *filename, const struct utimbuf *buf) -{ - return utime (filename, buf); -} - - -int -Gaskettcflush (int fildes, int queue_selector) -{ - return tcflush (fildes, queue_selector); -} - - -EFI_STATUS -GasketUgaCreate (struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title) -{ - return UgaCreate (UgaIo, Title); -} - - -void -Gasketperror (__const char *__s) -{ - perror (__s); - return; -} - - - -// -// ... is always an int or pointer to device specific data structure -// -int -Gasketioctl (int fd, unsigned long int __request, ...) -{ - VA_LIST Marker; - - VA_START (Marker, __request); - return ioctl (fd, __request, VA_ARG (Marker, UINTN)); -} - - -int -Gasketfcntl (int __fd, int __cmd, ...) -{ - VA_LIST Marker; - - VA_START (Marker, __cmd); - return fcntl (__fd, __cmd, VA_ARG (Marker, UINTN)); -} - - - -int -Gasketcfsetispeed (struct termios *__termios_p, speed_t __speed) -{ - return cfsetispeed (__termios_p, __speed); -} - - -int -Gasketcfsetospeed (struct termios *__termios_p, speed_t __speed) -{ - return cfsetospeed (__termios_p, __speed); -} - - -int -Gaskettcgetattr (int __fd, struct termios *__termios_p) -{ - return tcgetattr (__fd, __termios_p); -} - - -int -Gaskettcsetattr (int __fd, int __optional_actions, __const struct termios *__termios_p) -{ - return tcsetattr (__fd, __optional_actions, __termios_p); -} - - - - -RETURN_STATUS -GasketUnixPeCoffGetEntryPoint ( - IN VOID *Pe32Data, - IN OUT VOID **EntryPoint - ) -{ - return SecPeCoffGetEntryPoint (Pe32Data, EntryPoint); -} - - - -VOID -GasketUnixPeCoffRelocateImageExtraAction ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext - ) -{ - SecPeCoffRelocateImageExtraAction (ImageContext); - return; -} - - - -VOID -GasketUnixPeCoffUnloadImageExtraAction ( - IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext - ) -{ - SecPeCoffLoaderUnloadImageExtraAction (ImageContext); - return; -} - - -// -// Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL -// - -EFI_STATUS -EFIAPI -GasketUgaClose (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo) -{ - return UgaClose (UgaIo); -} - -EFI_STATUS -EFIAPI -GasketUgaSize (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, UINT32 Width, UINT32 Height) -{ - return UgaSize (UgaIo, Width, Height); -} - -EFI_STATUS -EFIAPI -GasketUgaCheckKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo) -{ - return UgaCheckKey (UgaIo); -} - -EFI_STATUS -EFIAPI -GasketUgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_INPUT_KEY *key) -{ - return UgaGetKey (UgaIo, key); -} - -EFI_STATUS -EFIAPI -GasketUgaBlt ( - EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, - IN EFI_UGA_PIXEL *BltBuffer OPTIONAL, - IN EFI_UGA_BLT_OPERATION BltOperation, - IN UGA_BLT_ARGS *Args - ) -{ - return UgaBlt (UgaIo, BltBuffer, BltOperation, Args); -} - -typedef void (*SET_TIMER_CALLBACK)(UINT64 delta); - - -UINTN -ReverseGasketUint64 (SET_TIMER_CALLBACK settimer_callback, UINT64 a) -{ - (*settimer_callback)(a); - return 0; -} -