Subversion Repositories Kolibri OS

Rev

Rev 8092 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8092 Rev 8150
Line 1... Line 1...
1
;*********************************************************************
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;*                                                                   *
2
;;                                                              ;;
-
 
3
;; Copyright (C) KolibriOS team 2020. All rights reserved.      ;;
-
 
4
;; Distributed under terms of the GNU General Public License    ;;
-
 
5
;; Version 2, or (at your option) any later version.            ;;
-
 
6
;;                                                              ;;
-
 
7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
8
;;                                                              ;;
3
;*          UEFI library for fasm by bzt, Public Domain              *
9
;; Based on UEFI library for fasm by bzt, Public Domain.        ;;
4
;*                                                                   *
10
;;                                                              ;;
5
;*********************************************************************
11
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
12
 
-
 
13
EFI_LOCATE_SEARCH_TYPE:
-
 
14
.AllHandles       = 0
-
 
15
.ByRegisterNotify = 1
-
 
16
.ByProtocol       = 2
Line 6... Line 17...
6
 
17
 
7
; EFI_MEMORY_TYPE
18
; EFI_MEMORY_TYPE
8
EFI_RESERVED_MEMORY_TYPE        = 0
19
EFI_RESERVED_MEMORY_TYPE        = 0
9
EFI_LOADER_CODE                 = 1
20
EFI_LOADER_CODE                 = 1
Line 25... Line 36...
25
; EFI_ALLOCATE_TYPE
36
; EFI_ALLOCATE_TYPE
26
EFI_ALLOCATE_ANY_PAGES   = 0
37
EFI_ALLOCATE_ANY_PAGES   = 0
27
EFI_ALLOCATE_MAX_ADDRESS = 1
38
EFI_ALLOCATE_MAX_ADDRESS = 1
28
EFI_ALLOCATE_ADDRESS     = 2
39
EFI_ALLOCATE_ADDRESS     = 2
Line 29... Line 40...
29
 
40
 
30
EFI_MEMORY_UC                   = 0x0000000000000001
41
EFI_MEMORY_UC                   = 0x00000001
31
EFI_MEMORY_WC                   = 0x0000000000000002
42
EFI_MEMORY_WC                   = 0x00000002
32
EFI_MEMORY_WT                   = 0x0000000000000004
43
EFI_MEMORY_WT                   = 0x00000004
33
EFI_MEMORY_WB                   = 0x0000000000000008
44
EFI_MEMORY_WB                   = 0x00000008
34
EFI_MEMORY_UCE                  = 0x0000000000000010
45
EFI_MEMORY_UCE                  = 0x00000010
35
EFI_MEMORY_WP                   = 0x0000000000001000
46
EFI_MEMORY_WP                   = 0x00001000
36
EFI_MEMORY_RP                   = 0x0000000000002000
47
EFI_MEMORY_RP                   = 0x00002000
37
EFI_MEMORY_XP                   = 0x0000000000004000
48
EFI_MEMORY_XP                   = 0x00004000
38
EFI_MEMORY_NV                   = 0x0000000000008000
49
EFI_MEMORY_NV                   = 0x00008000
39
EFI_MEMORY_MORE_RELIABLE        = 0x0000000000010000
50
EFI_MEMORY_MORE_RELIABLE        = 0x00010000
40
EFI_MEMORY_RO                   = 0x0000000000020000
-
 
Line 41... Line -...
41
EFI_MEMORY_RUNTIME              = 0x8000000000000000
-
 
42
 
51
EFI_MEMORY_RO                   = 0x00020000
43
EFIERR                          = 0x8000000000000000
52
 
44
EFI_SUCCESS                     = 0
53
EFI_SUCCESS                     = 0
45
EFI_LOAD_ERROR                  = EFIERR or 1
54
EFI_LOAD_ERROR                  = EFIERR or 1
46
EFI_INVALID_PARAMETER           = EFIERR or 2
55
EFI_INVALID_PARAMETER           = EFIERR or 2
Line 65... Line 74...
65
EFI_ABORTED                     = EFIERR or 21
74
EFI_ABORTED                     = EFIERR or 21
66
EFI_ICMP_ERROR                  = EFIERR or 22
75
EFI_ICMP_ERROR                  = EFIERR or 22
67
EFI_TFTP_ERROR                  = EFIERR or 23
76
EFI_TFTP_ERROR                  = EFIERR or 23
68
EFI_PROTOCOL_ERROR              = EFIERR or 24
77
EFI_PROTOCOL_ERROR              = EFIERR or 24
Line -... Line 78...
-
 
78
 
-
 
79
 
-
 
80
EFI_FILE_SYSTEM_INFO_ID equ 0x93,0x6e,0x57,0x09,0x3f,0x6d,0xd2,0x11, \
-
 
81
                            0x39,0x8e,0x00,0xa0,0xc9,0x69,0x72,0x3b
-
 
82
 
-
 
83
EFI_SYSTEM_TABLE_SIGNATURE equ 0x49,0x42,0x49,0x20,0x53,0x59,0x53,0x54
-
 
84
 
-
 
85
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x22,0x5b,0x4e,0x96, \
-
 
86
                                         0x59,0x64,0xd2,0x11, \
-
 
87
                                         0x8e,0x39,0x00,0xa0, \
-
 
88
                                         0xc9,0x69,0x72,0x3b
-
 
89
 
-
 
90
EFI_LOADED_IMAGE_PROTOCOL_GUID equ 0xA1,0x31,0x1b,0x5b,0x62,0x95,0xd2,0x11, \
-
 
91
                                    0x8E,0x3F,0x00,0xA0,0xC9,0x69,0x72,0x3B
-
 
92
 
-
 
93
EFI_BLOCK_IO_PROTOCOL_GUID equ 0x21,0x5b,0x4e,0x96,0x59,0x64,0xd2,0x11, \
-
 
94
                               0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b
-
 
95
 
-
 
96
EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID equ 0xde,0xa9,0x42,0x90,0xdc,0x23,0x38,0x4a, \
-
 
97
                                      0x96,0xfb,0x7a,0xde,0xd0,0x80,0x51,0x6a
-
 
98
 
-
 
99
EFI_FILE_MODE_READ   = 1
-
 
100
EFI_FILE_MODE_WRITE  = 2
-
 
101
EFI_FILE_MODE_CREATE = 0x8000000000000000
-
 
102
 
-
 
103
struct EFI_MEMORY_DESCRIPTOR
-
 
104
  Type          dd ?
-
 
105
                dd ?    ; align
-
 
106
  PhysicalStart DQ ?
-
 
107
  VirtualStart  DQ ?
-
 
108
  NumberOfPages DQ ?
-
 
109
  Attribute     DQ ?
-
 
110
ends
69
 
111
 
70
struct EFI_FILE_SYSTEM_INFO
112
struct EFI_FILE_SYSTEM_INFO
71
  Size          dq ?
113
  Size          DQ ?
72
  ReadOnly      db ?
114
  ReadOnly      db ?
73
                rb 7
115
                rb 7
74
  VolumeSize    dq ?
116
  VolumeSize    DQ ?
75
  FreeSpace     dq ?
117
  FreeSpace     DQ ?
76
  BlockSize     dd ?
118
  BlockSize     dd ?
77
  VolumeLabel   rw 32
119
  VolumeLabel   rw 32
Line 78... Line -...
78
ends
-
 
79
 
-
 
80
EFI_FILE_SYSTEM_INFO_ID equ 0x93,0x6e,0x57,0x09,0x3f,0x6d,0xd2,0x11, \
-
 
81
                            0x39,0x8e,0x00,0xa0,0xc9,0x69,0x72,0x3b
-
 
82
 
120
ends
83
EFI_SYSTEM_TABLE_SIGNATURE      equ     0x49,0x42,0x49,0x20,0x53,0x59,0x53,0x54
121
 
84
struct EFI_TABLE_HEADER
122
struct EFI_TABLE_HEADER
85
  Signature             dq ?
123
  Signature             DQ ?
86
  Revision              dd ?
124
  Revision              dd ?
87
  HeaderSize            dd ?
125
  HeaderSize            dd ?
88
  CRC32                 dd ?
126
  CRC32                 dd ?
Line 89... Line -...
89
  Reserved              dd ?
-
 
90
ends
-
 
91
 
-
 
92
struct EFI_SYSTEM_TABLE
-
 
93
  Hdr                   EFI_TABLE_HEADER
-
 
94
  FirmwareVendor        dq ?
-
 
95
  FirmwareRevision      dd ?
-
 
96
                        dd ?
-
 
97
  ConsoleInHandle       dq ?
-
 
98
  ConIn                 dq ?
-
 
99
  ConsoleOutHandle      dq ?
-
 
100
  ConOut                dq ?
-
 
101
  StandardErrorHandle   dq ?
-
 
102
  StdErr                dq ?
-
 
103
  RuntimeServices       dq ?
-
 
104
  BootServices          dq ?
-
 
105
  NumberOfTableEntries  dq ?
-
 
106
  ConfigurationTable    dq ?
127
  Reserved              dd ?
107
ends
128
ends
108
 
129
 
109
struct SIMPLE_TEXT_OUTPUT_INTERFACE
130
struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
110
  Reset                 dq ?
131
  Reset                 DN ?
111
  OutputString          dq ?
132
  OutputString          DN ?
112
  TestString            dq ?
133
  TestString            DN ?
113
  QueryMode             dq ?
134
  QueryMode             DN ?
114
  SetMode               dq ?
135
  SetMode               DN ?
115
  SetAttribute          dq ?
136
  SetAttribute          DN ?
116
  ClearScreen           dq ?
137
  ClearScreen           DN ?
117
  SetCursorPosition     dq ?
138
  SetCursorPosition     DN ?
Line 118... Line 139...
118
  EnableCursor          dq ?
139
  EnableCursor          DN ?
119
  Mode                  dq ?
140
  Mode                  DN ?
120
ends
141
ends
121
 
142
 
122
 
143
 
Line 123... Line 144...
123
struct SIMPLE_INPUT_INTERFACE
144
struct SIMPLE_INPUT_INTERFACE
124
  Reset                 dq ?
145
  Reset                 DN ?
125
  ReadKeyStroke         dq ?
146
  ReadKeyStroke         DN ?
126
  WaitForKey            dq ?
147
  WaitForKey            DN ?
127
ends
148
ends
128
 
149
 
129
struct EFI_BOOT_SERVICES_TABLE
150
struct EFI_BOOT_SERVICES
130
  Hdr                   EFI_TABLE_HEADER
151
  Hdr                        EFI_TABLE_HEADER
131
  RaisePriority         dq ?
152
  RaisePriority              DN ?
132
  RestorePriority       dq ?
153
  RestorePriority            DN ?
133
  AllocatePages         dq ?
154
  AllocatePages              DN ?
134
  FreePages             dq ?
155
  FreePages                  DN ?
135
  GetMemoryMap          dq ?
156
  GetMemoryMap               DN ?
136
  AllocatePool          dq ?
157
  AllocatePool               DN ?
137
  FreePool              dq ?
158
  FreePool                   DN ?
138
  CreateEvent           dq ?
159
  CreateEvent                DN ?
139
  SetTimer              dq ?
160
  SetTimer                   DN ?
140
  WaitForEvent          dq ?
161
  WaitForEvent               DN ?
141
  SignalEvent           dq ?
162
  SignalEvent                DN ?
142
  CloseEvent            dq ?
163
  CloseEvent                 DN ?
143
  CheckEvent            dq ?
164
  CheckEvent                 DN ?
144
  InstallProtocolInterface dq ?
165
  InstallProtocolInterface   DN ?
145
  ReInstallProtocolInterface dq ?
166
  ReInstallProtocolInterface DN ?
146
  UnInstallProtocolInterface dq ?
167
  UnInstallProtocolInterface DN ?
147
  HandleProtocol        dq ?
168
  HandleProtocol             DN ?
148
  Void                  dq ?
169
  Reserved                   DN ?
149
  RegisterProtocolNotify dq ?
170
  RegisterProtocolNotify     DN ?
150
  LocateHandle          dq ?
171
  LocateHandle               DN ?
151
  LocateDevicePath      dq ?
172
  LocateDevicePath           DN ?
152
  InstallConfigurationTable dq ?
173
  InstallConfigurationTable  DN ?
153
  ImageLoad             dq ?
174
  ImageLoad                  DN ?
154
  ImageStart            dq ?
175
  ImageStart                 DN ?
155
  Exit                  dq ?
176
  Exit                       DN ?
156
  ImageUnLoad           dq ?
177
  ImageUnLoad                DN ?
157
  ExitBootServices      dq ?
178
  ExitBootServices           DN ?
158
  GetNextMonotonicCount dq ?
179
  GetNextMonotonicCount      DN ?
159
  Stall                 dq ?
180
  Stall                      DN ?
160
  SetWatchdogTimer      dq ?
181
  SetWatchdogTimer           DN ?
161
  ConnectController     dq ?
182
  ConnectController          DN ?
162
  DisConnectController  dq ?
183
  DisConnectController       DN ?
163
  OpenProtocol          dq ?
184
  OpenProtocol               DN ?
164
  CloseProtocol         dq ?
185
  CloseProtocol              DN ?
165
  OpenProtocolInformation dq ?
186
  OpenProtocolInformation    DN ?
166
  ProtocolsPerHandle    dq ?
187
  ProtocolsPerHandle         DN ?
167
  LocateHandleBuffer    dq ?
188
  LocateHandleBuffer         DN ?
168
  LocateProtocol        dq ?
189
  LocateProtocol             DN ?
Line 169... Line 190...
169
  InstallMultipleProtocolInterfaces dq ?
190
  InstallMultipleProtocolInterfaces DN ?
170
  UnInstallMultipleProtocolInterfaces dq ?
191
  UnInstallMultipleProtocolInterfaces DN ?
171
  CalculateCrc32        dq ?
192
  CalculateCrc32             DN ?
172
  CopyMem               dq ?
193
  CopyMem                    DN ?
173
  SetMem                dq ?
194
  SetMem                     DN ?
174
ends
195
ends
175
 
196
 
176
struct EFI_RUNTIME_SERVICES_TABLE
197
struct EFI_RUNTIME_SERVICES
177
  Hdr                   EFI_TABLE_HEADER
198
  Hdr                   EFI_TABLE_HEADER
178
  GetTime               dq ?
199
  GetTime               DN ?
179
  SetTime               dq ?
200
  SetTime               DN ?
180
  GetWakeUpTime         dq ?
201
  GetWakeUpTime         DN ?
181
  SetWakeUpTime         dq ?
202
  SetWakeUpTime         DN ?
182
  SetVirtualAddressMap  dq ?
-
 
183
  ConvertPointer        dq ?
-
 
184
  GetVariable           dq ?
-
 
185
  GetNextVariableName   dq ?
-
 
186
  SetVariable           dq ?
-
 
187
  GetNextHighMonoCount  dq ?
-
 
188
  ResetSystem           dq ?
-
 
189
ends
-
 
190
 
-
 
191
struct EFI_TIME
-
 
192
  Year                  dw ?
-
 
193
  Month                 db ?
-
 
194
  Day                   db ?
-
 
195
  Hour                  db ?
-
 
196
  Minute                db ?
-
 
197
  Second                db ?
203
  SetVirtualAddressMap  DN ?
Line 198... Line -...
198
  Pad1                  db ?
-
 
199
  Nanosecond            dd ?
-
 
200
  TimeZone              dw ?
-
 
201
  Daylight              db ?
204
  ConvertPointer        DN ?
202
  Pad2                  db ?
205
  GetVariable           DN ?
203
  sizeof                db ?
206
  GetNextVariableName   DN ?
204
ends
207
  SetVariable           DN ?
Line 205... Line -...
205
 
-
 
206
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x22,0x5b,0x4e,0x96,0x59,0x64,0xd2,0x11, \
-
 
207
                                         0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b
-
 
208
 
-
 
209
struct EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
208
  GetNextHighMonoCount  DN ?
210
  Revision              dq ?
209
  ResetSystem           DN ?
211
  OpenVolume            dq ?
210
ends
212
ends
211
 
213
 
212
struct EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
214
EFI_FILE_MODE_READ   = 1
213
  Revision              DQ ?
215
EFI_FILE_MODE_WRITE  = 2
214
  OpenVolume            DN ?
216
EFI_FILE_MODE_CREATE = 0x8000000000000000
215
ends
217
 
216
 
218
struct EFI_FILE_PROTOCOL
217
struct EFI_FILE_PROTOCOL
219
  Revision              dq ?
218
  Revision              DQ ?
220
  Open                  dq ?
219
  Open                  DN ?
221
  Close                 dq ?
220
  Close                 DN ?
222
  Delete                dq ?
221
  Delete                DN ?
223
  Read                  dq ?
222
  Read                  DN ?
224
  Write                 dq ?
223
  Write                 DN ?
225
  GetPosition           dq ?
-
 
226
  SetPosition           dq ?
-
 
227
  GetInfo               dq ?
-
 
228
  SetInfo               dq ?
-
 
229
  Flush                 dq ?
-
 
230
  OpenEx                dq ?
-
 
231
  ReadEx                dq ?
-
 
232
  WriteEx               dq ?
-
 
233
  FlushEx               dq ?
-
 
234
ends
-
 
235
 
-
 
236
EFI_LOADED_IMAGE_PROTOCOL_GUID  equ     0xA1,0x31,0x1b,0x5b,0x62,0x95,0xd2,0x11, \
-
 
237
                                        0x8E,0x3F,0x00,0xA0,0xC9,0x69,0x72,0x3B
-
 
238
struct EFI_LOADED_IMAGE_PROTOCOL
-
 
239
  Revision              dd ?
-
 
240
                        dd ?
-
 
241
  ParentHandle          dq ?
-
 
242
  SystemTable           dq ?
-
 
243
  DeviceHandle          dq ?
-
 
244
  FilePath              dq ?
224
  GetPosition           DN ?
Line 245... Line -...
245
  Reserved              dq ?
-
 
246
  LoadOptionsSize       dd ?
-
 
247
                        dd ?
-
 
248
  ImageBase             dq ?
-
 
249
  ImageSize             dq ?
-
 
250
  ImageCodeType         dd ?
-
 
251
  ImageDataType         dd ?
-
 
252
  UnLoad                dq ?
-
 
253
ends
-
 
254
 
-
 
255
EFI_BLOCK_IO_PROTOCOL_GUID      equ     0x21,0x5b,0x4e,0x96,0x59,0x64,0xd2,0x11, \
-
 
256
                                        0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b
-
 
257
struct EFI_BLOCK_IO_PROTOCOL
-
 
258
  Revision              dq ?
-
 
259
  Media                 dq ?
-
 
260
  Reset                 dq ?
-
 
261
  ReadBlocks            dq ?
-
 
262
  WriteBlocks           dq ?
-
 
263
  FlushBlocks           dq ?
-
 
264
ends
-
 
265
 
-
 
266
struct EFI_BLOCK_IO_MEDIA
-
 
267
  MediaId               dd ?
-
 
268
  RemovableMedia        db ?
-
 
269
  MediaPresent          db ?
-
 
270
  LogicalPartition      db ?
-
 
271
  ReadOnly              db ?
225
  SetPosition           DN ?
272
  WriteCaching          db ?
226
  GetInfo               DN ?
273
                        rb 3
227
  SetInfo               DN ?
274
  BlockSize             dd ?
228
  Flush                 DN ?
275
  IoAlign               dd ?
229
  OpenEx                DN ?
276
  LastBlock             dq ?
230
  ReadEx                DN ?
Line 277... Line 231...
277
ends
231
  WriteEx               DN ?
278
 
232
  FlushEx               DN ?
279
EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID equ   0xde,0xa9,0x42,0x90,0xdc,0x23,0x38,0x4a, \
233
ends
280
                                        0x96,0xfb,0x7a,0xde,0xd0,0x80,0x51,0x6a
234
 
281
struct EFI_GRAPHICS_OUTPUT_PROTOCOL
235
struct EFI_GRAPHICS_OUTPUT_PROTOCOL
282
  QueryMode             dq ?
236
  QueryMode             DN ?
283
  SetMode               dq ?
237
  SetMode               DN ?
-
 
238
  Blt                   DN ?
-
 
239
  Mode                  DN ?
-
 
240
ends
-
 
241
 
-
 
242
struct EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE
-
 
243
  MaxMode               dd ?
-
 
244
  Mode                  dd ?
-
 
245
  Info                  DN ?
-
 
246
  SizeOfInfo            DN ?
-
 
247
  FrameBufferBase       DQ ?
-
 
248
  FrameBufferSize       DN ?
-
 
249
ends
-
 
250
 
-
 
251
EFI_GRAPHICS_PIXEL_FORMAT:
284
  Blt                   dq ?
252
.PixelRedGreenBlueReserved8BitPerColor = 0
Line 285... Line 253...
285
  Mode                  dq ?
253
.PixelBlueGreenRedReserved8BitPerColor = 1
286
ends
254
.PixelBitMask = 2
287
 
255
.PixelBltOnly = 3
288
struct EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE
256
.PixelFormatMax = 4
289
  MaxMode               dd ?
257
 
290
  Mode                  dd ?
-
 
291
  nfo                   dq ?
258
struct EFI_PIXEL_BITMASK
292
  SizeOfInfo            dq ?
-
 
293
  FrameBufferBase       dq ?
-
 
294
  FrameBufferSize       dq ?
259
  RedMask               dd ?
295
ends
260
  GreenMask             dd ?
296
 
-
 
297
struct EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
-
 
298
  Version               dd ?
-
 
299
  HorizontalResolution  dd ?
-
 
300
  VerticalResolution    dd ?
-
 
301
  PixelFormat           dd ?
-
 
302
  RedMask               dd ?
-
 
303
  GreenMask             dd ?
-
 
304
  BlueMask              dd ?
-
 
305
  Reserved              dd ?
-
 
306
  PixelsPerScanLine     dd ?
-
 
307
ends
-
 
308
 
-
 
309
;---macros to make life easier---
-
 
310
;call it early, after entry point is the best
-
 
311
macro InitializeLib
-
 
312
{
-
 
313
        clc
-
 
314
        test    rdx, rdx
-
 
315
        jz      .badout
-
 
316
        cmp     dword[rdx], 'IBI '      ; 20494249h
-
 
317
        jz      @f
-
 
318
  .badout:
-
 
319
        xor     ecx, ecx
-
 
320
        xor     edx, edx
-
 
321
        stc
-
 
322
    @@:
-
 
323
        mov     [efi_handler], rcx      ; ImageHandle
-
 
324
        mov     [efi_ptr], rdx          ; pointer to SystemTable
-
 
325
}
-
 
326
 
-
 
327
;invoke an UEFI function
-
 
328
macro eficall interface,function,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11
-
 
329
{
-
 
330
numarg = 0
-
 
331
 
-
 
332
if ~ arg11 eq
-
 
333
  numarg = numarg + 1
-
 
334
  if ~ arg11 eq rdi
-
 
335
        mov     rdi, arg11
-
 
336
  end if
-
 
337
end if
-
 
338
 
-
 
339
if ~ arg10 eq
-
 
340
  numarg = numarg + 1
-
 
341
  if ~ arg10 eq rsi
-
 
342
        mov     rsi, arg10
-
 
343
  end if
-
 
344
end if
-
 
345
 
-
 
346
if ~ arg9 eq
-
 
347
  numarg = numarg + 1
-
 
348
  if ~ arg9 eq r14
-
 
349
        mov     r14, arg9
-
 
350
  end if
-
 
351
end if
-
 
352
 
-
 
353
if ~ arg8 eq
-
 
354
  numarg = numarg + 1
-
 
355
  if ~ arg8 eq r13
-
 
356
        mov     r13, arg8
-
 
357
  end if
-
 
358
end if
-
 
359
 
-
 
360
if ~ arg7 eq
-
 
361
  numarg = numarg + 1
-
 
362
  if ~ arg7 eq r12
-
 
363
        mov     r12, arg7
-
 
364
  end if
-
 
365
end if
-
 
366
 
-
 
367
if ~ arg6 eq
-
 
368
  numarg = numarg + 1
-
 
369
  if ~ arg6 eq r11
-
 
370
        mov     r11, arg6
-
 
371
  end if
-
 
372
end if
-
 
373
 
-
 
374
if ~ arg5 eq
-
 
375
  numarg = numarg + 1
-
 
376
  if ~ arg5 eq r10
-
 
377
        mov     r10, arg5
-
 
378
  end if
-
 
379
end if
-
 
380
 
-
 
381
if ~ arg4 eq
-
 
382
  numarg = numarg + 1
-
 
383
  if ~ arg4 eq r9
-
 
384
        mov     r9, arg4
-
 
385
  end if
-
 
386
end if
-
 
387
 
-
 
388
if ~ arg3 eq
-
 
389
  numarg = numarg + 1
-
 
390
  if ~ arg3 eq r8
-
 
391
        mov     r8, arg3
-
 
392
  end if
-
 
393
end if
-
 
394
 
-
 
395
if ~ arg2 eq
-
 
396
  numarg = numarg + 1
-
 
397
  if ~ arg2 eq rdx
-
 
398
        mov     rdx, arg2
-
 
399
  end if
-
 
400
end if
-
 
401
 
-
 
402
if ~ arg1 eq
-
 
403
  numarg = numarg + 1
-
 
404
  if ~ arg1 eq rcx
-
 
405
    if ~ arg1 in 
-
 
406
        mov     rcx, arg1
-
 
407
    end if
-
 
408
  end if
-
 
409
end if
-
 
410
 
-
 
411
        xor     rax, rax
-
 
412
        mov     al, numarg
-
 
413
 
-
 
414
if interface in 
-
 
415
        mov     rbx, [efi_ptr]
-
 
416
        mov     rbx, [rbx + EFI_SYSTEM_TABLE.#interface]
-
 
417
else
-
 
418
  if ~ interface eq rbx
-
 
419
        mov     rbx, interface
-
 
420
  end if
-
 
421
end if
-
 
422
 
-
 
423
if arg1 in 
-
 
424
        mov     rcx, rbx
-
 
425
end if
-
 
426
 
-
 
427
if defined SIMPLE_INPUT_INTERFACE.#function
-
 
428
        mov     rbx, [rbx + SIMPLE_INPUT_INTERFACE.#function]
-
 
429
else
-
 
430
 if defined SIMPLE_TEXT_OUTPUT_INTERFACE.#function
-
 
431
        mov     rbx, [rbx + SIMPLE_TEXT_OUTPUT_INTERFACE.#function]
-
 
432
 else
-
 
433
  if defined EFI_BOOT_SERVICES_TABLE.#function
-
 
434
        mov     rbx, [rbx + EFI_BOOT_SERVICES_TABLE.#function]
-
 
435
  else
-
 
436
   if defined EFI_RUNTIME_SERVICES_TABLE.#function
-
 
437
        mov     rbx, [rbx + EFI_RUNTIME_SERVICES_TABLE.#function]
-
 
438
   else
-
 
439
    if defined EFI_GRAPHICS_OUTPUT_PROTOCOL.#function
-
 
440
        mov     rbx, [rbx + EFI_GRAPHICS_OUTPUT_PROTOCOL.#function]
-
 
441
    else
-
 
442
     if defined EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.#function
-
 
443
        mov     rbx, [rbx + EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE.#function]
-
 
444
     else
-
 
445
        mov     rbx, [rbx + function]
-
 
446
     end if
-
 
447
    end if
-
 
448
   end if
-
 
449
  end if
-
 
450
 end if
-
 
451
end if
-
 
452
        call    uefifunc
-
 
453
}
-
 
454
 
-
 
455
;*********************************************************************
-
 
456
;*                       Library functions                           *
-
 
457
;*********************************************************************
-
 
458
 
-
 
459
section '.text' code executable readable
-
 
460
 
-
 
461
uefifunc:
-
 
462
        ;save stack pointer
-
 
463
        mov     qword [uefi_rsptmp], rsp
-
 
464
        ;set up new aligned stack
-
 
465
        and     esp, 0xFFFFFFF0
-
 
466
        ;alignment check on arguments
-
 
467
        bt      eax, 0
-
 
468
        jnc     @f
-
 
469
        push    rax
-
 
470
        ;arguments
-
 
471
@@:
-
 
472
        cmp     al, 11
-
 
473
        jb      @f
-
 
474
        push    rdi
-
 
475
@@:
-
 
476
        cmp     al, 10
-
 
477
        jb      @f
-
 
478
        push    rsi
-
 
479
@@:
-
 
480
        cmp     al, 9
-
 
481
        jb      @f
-
 
482
        push    r14
-
 
483
@@:
-
 
484
        cmp     al, 8
-
 
485
        jb      @f
-
 
486
        push    r13
-
 
487
@@:
-
 
488
        cmp     al, 7
-
 
489
        jb      @f
-
 
490
        push    r12
-
 
491
@@:
-
 
492
        cmp     al, 6
-
 
493
        jb      @f
-
 
494
        push    r11
-
 
495
@@:
-
 
496
        cmp     al, 5
-
 
497
        jb      @f
-
 
498
        push    r10
-
 
499
@@:
-
 
500
        ;space for
-
 
501
        ;r9
-
 
502
        ;r8
-
 
503
        ;rdx
-