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.
18 #include <Library/PeCoffLib.h>
20 #include <Protocol/UgaDraw.h>
21 #include <Protocol/SimpleTextIn.h>
22 #include <Protocol/UnixUgaIo.h>
26 // Gasket functions for EFI_UNIX_THUNK_PROTOCOL
29 void GasketmsSleep (unsigned long Milliseconds
);
30 void Gasketexit (int status
);
31 void GasketSetTimer (UINT64 PeriodMs
, VOID (*CallBack
)(UINT64 DeltaMs
));
32 void GasketGetLocalTime (EFI_TIME
*Time
);
33 struct tm
*Gasketgmtime (const time_t *clock
);
34 long GasketGetTimeZone (void);
35 int GasketGetDayLight (void);
36 int Gasketpoll (struct pollfd
*pfd
, int nfds
, int timeout
);
37 int Gasketread (int fd
, void *buf
, int count
);
38 int Gasketwrite (int fd
, const void *buf
, int count
);
39 char *Gasketgetenv (const char *name
);
40 int Gasketopen (const char *name
, int flags
, int mode
);
41 off_t
Gasketlseek (int fd
, off_t off
, int whence
);
42 int Gasketftruncate (int fd
, long int len
);
43 int Gasketclose (int fd
);
44 int Gasketmkdir (const char *pathname
, mode_t mode
);
45 int Gasketrmdir (const char *pathname
);
46 int Gasketunlink (const char *pathname
);
47 int GasketGetErrno (void);
48 DIR *Gasketopendir (const char *pathname
);
49 void *Gasketrewinddir (DIR *dir
);
50 struct dirent
*Gasketreaddir (DIR *dir
);
51 int Gasketclosedir (DIR *dir
);
52 int Gasketstat (const char *path
, STAT_FIX
*buf
);
53 int Gasketstatfs (const char *path
, struct statfs
*buf
);
54 int Gasketrename (const char *oldpath
, const char *newpath
);
55 time_t Gasketmktime (struct tm
*tm
);
56 int Gasketfsync (int fd
);
57 int Gasketchmod (const char *path
, mode_t mode
);
58 int Gasketutime (const char *filename
, const struct utimbuf
*buf
);
59 int Gaskettcflush (int fildes
, int queue_selector
);
60 EFI_STATUS
GasketUgaCreate(struct _EFI_UNIX_UGA_IO_PROTOCOL
**UgaIo
, CONST CHAR16
*Title
);
61 void Gasketperror (__const
char *__s
);
64 // ... is always an int or pointer to device specific data structure
66 int Gasketioctl (int fd
, unsigned long int __request
, ...);
67 int Gasketfcntl (int __fd
, int __cmd
, ...);
69 int Gasketcfsetispeed (struct termios
*__termios_p
, speed_t __speed
);
70 int Gasketcfsetospeed (struct termios
*__termios_p
, speed_t __speed
);
71 int Gaskettcgetattr (int __fd
, struct termios
*__termios_p
);
72 int Gaskettcsetattr (int __fd
, int __optional_actions
, __const
struct termios
*__termios_p
);
73 int Gasketsigaction (int sig
, const struct sigaction
*act
, struct sigaction
*oact
);
74 int Gasketsetcontext (const ucontext_t
*ucp
);
75 int Gasketgetcontext (ucontext_t
*ucp
);
76 int Gasketsigemptyset (sigset_t
*set
);
77 int Gasketsigaltstack (const stack_t
*ss
, stack_t
*oss
);
80 GasketUnixPeCoffGetEntryPoint (
82 IN OUT VOID
**EntryPoint
86 GasketUnixPeCoffRelocateImageExtraAction (
87 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
91 GasketPeCoffLoaderUnloadImageExtraAction (
92 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
96 int GasketVoid (void *api
);
97 int GasketUintn (void *api
, UINTN a
);
98 int GasketUintnUintn (void *api
, UINTN a
, UINTN b
);
99 int GasketUintnUintnUintn (void *api
, UINTN a
, UINTN b
, UINTN c
);
100 int GasketUintnUintnUintnUintn (void *api
, UINTN a
, UINTN b
, UINTN c
, UINTN d
);
101 int GasketUintn10Args (void *api
, UINTN a
, UINTN b
, UINTN c
, UINTN d
, UINTN e
, UINTN f
, UINTN g
, UINTN h
, UINTN i
, UINTN j
);
102 int GasketUint64Uintn (void *api
, UINT64 a
, UINTN b
);
103 UINT64
GasketUintnUint64Uintn (void *api
, UINTN a
, UINT64 b
, UINTN c
);
104 int GasketUintnUint16 (void *api
, UINTN a
, UINT16 b
);
108 // Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL
111 EFI_STATUS EFIAPI
GasketUgaClose (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
);
112 EFI_STATUS EFIAPI
GasketUgaSize (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
, UINT32 Width
, UINT32 Height
);
113 EFI_STATUS EFIAPI
GasketUgaCheckKey (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
);
114 EFI_STATUS EFIAPI
GasketUgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
, EFI_INPUT_KEY
*key
);
115 EFI_STATUS EFIAPI
GasketUgaBlt (
116 EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
,
117 IN EFI_UGA_PIXEL
*BltBuffer OPTIONAL
,
118 IN EFI_UGA_BLT_OPERATION BltOperation
,
121 IN UINTN DestinationX
,
122 IN UINTN DestinationY
,
125 IN UINTN Delta OPTIONAL
128 EFI_STATUS
UgaCreate (EFI_UNIX_UGA_IO_PROTOCOL
**Uga
, CONST CHAR16
*Title
);
132 // Gasket functions for EFI_UNIX_UGA_IO_PROTOCOL
134 EFI_STATUS
UgaClose (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
);
135 EFI_STATUS
UgaSize(EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
, UINT32 Width
, UINT32 Height
);
136 EFI_STATUS
UgaCheckKey(EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
);
137 EFI_STATUS
UgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
, EFI_INPUT_KEY
*key
);
138 EFI_STATUS
UgaBlt (EFI_UNIX_UGA_IO_PROTOCOL
*UgaIo
,
139 IN EFI_UGA_PIXEL
*BltBuffer OPTIONAL
,
140 IN EFI_UGA_BLT_OPERATION BltOperation
,
143 IN UINTN DestinationX
,
144 IN UINTN DestinationY
,
147 IN UINTN Delta OPTIONAL