3 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 // OS X Posix does some strange name mangling on these names in C.
20 // If you call from assembler you get the wrong version of the function
21 // So these globals get you the correct name mangled functions that can
22 // be accessed from assembly
24 extern UnixRmDir gUnixRmDir
;
25 extern UnixOpenDir gUnixOpenDir
;
26 extern UnixStat gUnixStat
;
27 extern UnixStatFs gUnixStatFs
;
30 // Gasket functions for EFI_UNIX_THUNK_PROTOCOL
34 Gasketrmdir (const char *pathname
)
36 return gUnixRmDir (pathname
);
41 Gasketopendir (const char *pathname
)
43 return gUnixOpenDir (pathname
);
48 Gasketstat (const char *path
, STAT_FIX
*buf
)
50 return gUnixStat (path
, buf
);
55 Gasketstatfs (const char *path
, struct statfs
*buf
)
57 return gUnixStatFs (path
, buf
);
64 GasketmsSleep (unsigned long Milliseconds
)
66 msSleep (Milliseconds
);
71 Gasketexit (int status
)
79 GasketSetTimer (UINT64 PeriodMs
, VOID (*CallBack
)(UINT64 DeltaMs
))
81 SetTimer (PeriodMs
, CallBack
);
87 GasketGetLocalTime (EFI_TIME
*Time
)
95 Gasketgmtime (const time_t *clock
)
97 return localtime (clock
);
102 GasketGetTimeZone (void)
104 return GetTimeZone ();
109 GasketGetDayLight (void)
111 return GetDayLight ();
116 Gasketpoll (struct pollfd
*pfd
, unsigned int nfds
, int timeout
)
118 return poll (pfd
, nfds
, timeout
);
123 Gasketread (int fd
, void *buf
, int count
)
125 return read (fd
, buf
, count
);
130 Gasketwrite (int fd
, const void *buf
, int count
)
132 return write (fd
, buf
, count
);
137 Gasketgetenv (const char *name
)
139 return getenv (name
);
144 Gasketopen (const char *name
, int flags
, int mode
)
146 return open (name
, flags
, mode
);
151 Gasketlseek (int fd
, off_t off
, int whence
)
153 return lseek (fd
, off
, whence
);
158 Gasketftruncate (int fd
, long int len
)
160 return ftruncate (fd
, len
);
172 Gasketmkdir (const char *pathname
, mode_t mode
)
174 return mkdir (pathname
, mode
);
179 Gasketunlink (const char *pathname
)
181 return unlink (pathname
);
186 GasketGetErrno (void)
193 Gasketrewinddir (DIR *dir
)
201 Gasketreaddir (DIR *dir
)
203 return readdir (dir
);
208 Gasketclosedir (DIR *dir
)
210 return closedir (dir
);
215 Gasketrename (const char *oldpath
, const char *newpath
)
217 return rename (oldpath
, newpath
);
222 Gasketmktime (struct tm
*tm
)
236 Gasketchmod (const char *path
, mode_t mode
)
238 return chmod (path
, mode
);
243 Gasketutime (const char *filename
, const struct utimbuf
*buf
)
245 return utime (filename
, buf
);
250 Gaskettcflush (int fildes
, int queue_selector
)
252 return tcflush (fildes
, queue_selector
);
257 GasketUgaCreate (struct _EFI_UNIX_UGA_IO_PROTOCOL
**UgaIo
, CONST CHAR16
*Title
)
259 return UgaCreate (UgaIo
, Title
);
264 Gasketperror (__const
char *__s
)
273 // ... is always an int or pointer to device specific data structure
276 Gasketioctl (int fd
, unsigned long int __request
, ...)
280 VA_START (Marker
, __request
);
281 return ioctl (fd
, __request
, VA_ARG (Marker
, UINTN
));
286 Gasketfcntl (int __fd
, int __cmd
, ...)
290 VA_START (Marker
, __cmd
);
291 return fcntl (__fd
, __cmd
, VA_ARG (Marker
, UINTN
));
297 Gasketcfsetispeed (struct termios
*__termios_p
, speed_t __speed
)
299 return cfsetispeed (__termios_p
, __speed
);
304 Gasketcfsetospeed (struct termios
*__termios_p
, speed_t __speed
)
306 return cfsetospeed (__termios_p
, __speed
);
311 Gaskettcgetattr (int __fd
, struct termios
*__termios_p
)
313 return tcgetattr (__fd
, __termios_p
);
318 Gaskettcsetattr (int __fd
, int __optional_actions
, __const
struct termios
*__termios_p
)
320 return tcsetattr (__fd
, __optional_actions
, __termios_p
);
327 GasketUnixPeCoffGetEntryPoint (
329 IN OUT VOID
**EntryPoint
332 return SecPeCoffGetEntryPoint (Pe32Data
, EntryPoint
);
338 GasketUnixPeCoffRelocateImageExtraAction (
339 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
342 SecPeCoffRelocateImageExtraAction (ImageContext
);
349 GasketUnixPeCoffUnloadImageExtraAction (
350 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
353 SecPeCoffLoaderUnloadImageExtraAction (ImageContext
);
359 // Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL
364 GasketUgaClose (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
)
366 return UgaClose (UgaIo
);
371 GasketUgaSize (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
, UINT32 Width
, UINT32 Height
)
373 return UgaSize (UgaIo
, Width
, Height
);
378 GasketUgaCheckKey (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
)
380 return UgaCheckKey (UgaIo
);
385 GasketUgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
, EFI_INPUT_KEY
*key
)
387 return UgaGetKey (UgaIo
, key
);
393 EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
,
394 IN EFI_UGA_PIXEL
*BltBuffer OPTIONAL
,
395 IN EFI_UGA_BLT_OPERATION BltOperation
,
396 IN UGA_BLT_ARGS
*Args
399 return UgaBlt (UgaIo
, BltBuffer
, BltOperation
, Args
);
402 typedef void (*SET_TIMER_CALLBACK
)(UINT64 delta
);
406 ReverseGasketUint64 (SET_TIMER_CALLBACK settimer_callback
, UINT64 a
)
408 (*settimer_callback
)(a
);