]> git.proxmox.com Git - mirror_edk2.git/blob - InOsEmuPkg/Unix/Sec/X64/Gasket.S
Add InOsEmuPkg. Like UnixPkg and Nt32Pkg, but EFI code can be common and does not...
[mirror_edk2.git] / InOsEmuPkg / Unix / Sec / X64 / Gasket.S
1 #------------------------------------------------------------------------------
2 #
3 # Manage differenced between UNIX ABI and EFI/Windows ABI
4 #
5 # EFI Arg passing: RCX, RDX, R8, R9
6 # Callee allocates 32 bytes on stack to spill registers
7 # UNIX Arg passing: RDI, RSI, RDX, RCX, R8, R9
8 # RSI, RDI calle-save on EFI, scatch on UNIX callign
9 #
10 # Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
11 # This program and the accompanying materials
12 # are licensed and made available under the terms and conditions of the BSD License
13 # which accompanies this distribution. The full text of the license may be found at
14 # http://opensource.org/licenses/bsd-license.php
15 #
16 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #
19 #------------------------------------------------------------------------------
20
21 //
22 // Gaskets are EFI ABI to UNIX ABI calls
23 // EFI ABI code will sub 40 (0x28) from %rsp before calling a function
24 // This is the 32 (0x20) byte to spill registers and 8 bytes to align stack on 16 byte boundry.
25 //
26 .text
27
28 // 32 byte shadow to spill rcx-r9, 8 bytes to align stack on 16 byte boundry
29 // Any call with 0 - 4 arguments allocates 40 bytes on the stack.
30 // For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56,
31 // 7 or 8 args is 72, and 9 or 10 args is 88
32
33
34
35 .text
36
37 //
38 // EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI)
39 //
40
41
42
43
44 ASM_GLOBAL ASM_PFX(GasketSecWriteStdErr)
45 ASM_PFX(GasketSecWriteStdErr):
46 pushq %rbp // stack frame is for the debugger
47 movq %rsp, %rbp
48
49 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
50 pushq %rdi
51
52 movq %rcx, %rdi // Swizzle args
53 movq %rdx, %rsi
54
55 call ASM_PFX(SecWriteStdErr)
56
57 popq %rdi // restore state
58 popq %rsi
59 popq %rbp
60 ret
61
62
63 ASM_GLOBAL ASM_PFX(GasketSecSetTimer)
64 ASM_PFX(GasketSecSetTimer):
65 pushq %rbp // stack frame is for the debugger
66 movq %rsp, %rbp
67
68 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
69 pushq %rdi
70
71 movq %rcx, %rdi // Swizzle args
72 movq %rdx, %rsi
73
74 call ASM_PFX(SecSetTimer)
75
76 popq %rdi // restore state
77 popq %rsi
78 popq %rbp
79 ret
80
81
82 ASM_GLOBAL ASM_PFX(GasketSecEnableInterrupt)
83 ASM_PFX(GasketSecEnableInterrupt):
84 pushq %rbp // stack frame is for the debugger
85 movq %rsp, %rbp
86
87 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
88 pushq %rdi
89
90 call ASM_PFX(SecEnableInterrupt)
91
92 popq %rdi // restore state
93 popq %rsi
94 popq %rbp
95 ret
96
97
98 ASM_GLOBAL ASM_PFX(GasketSecDisableInterrupt)
99 ASM_PFX(GasketSecDisableInterrupt):
100 pushq %rbp // stack frame is for the debugger
101 movq %rsp, %rbp
102
103 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
104 pushq %rdi
105
106 call ASM_PFX(SecDisableInterrupt)
107
108 popq %rdi // restore state
109 popq %rsi
110 popq %rbp
111 ret
112
113 ASM_GLOBAL ASM_PFX(GasketQueryPerformanceFrequency)
114 ASM_PFX(GasketQueryPerformanceFrequency):
115 pushq %rbp // stack frame is for the debugger
116 movq %rsp, %rbp
117
118 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
119 pushq %rdi
120
121 call ASM_PFX(QueryPerformanceFrequency)
122
123 popq %rdi // restore state
124 popq %rsi
125 popq %rbp
126 ret
127
128
129 ASM_GLOBAL ASM_PFX(GasketQueryPerformanceCounter)
130 ASM_PFX(GasketQueryPerformanceCounter):
131 pushq %rbp // stack frame is for the debugger
132 movq %rsp, %rbp
133
134 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
135 pushq %rdi
136
137 call ASM_PFX(QueryPerformanceCounter)
138
139 popq %rdi // restore state
140 popq %rsi
141 popq %rbp
142 ret
143
144
145 ASM_GLOBAL ASM_PFX(GasketSecSleep)
146 ASM_PFX(GasketSecSleep):
147 pushq %rbp // stack frame is for the debugger
148 movq %rsp, %rbp
149
150 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
151 pushq %rdi
152
153 movq %rcx, %rdi // Swizzle args
154
155 call ASM_PFX(SecSleep)
156
157 popq %rdi // restore state
158 popq %rsi
159 popq %rbp
160 ret
161
162
163 ASM_GLOBAL ASM_PFX(GasketSecExit)
164 ASM_PFX(GasketSecExit):
165 pushq %rbp // stack frame is for the debugger
166 movq %rsp, %rbp
167
168 movq %rcx, %rdi // Swizzle args
169 call ASM_PFX(SecExit) // Less to do as we will never return to EFI ABI world
170 LDEAD_LOOP:
171 jmp LDEAD_LOOP // _exit should never return
172
173
174 ASM_GLOBAL ASM_PFX(GasketSecGetTime)
175 ASM_PFX(GasketSecGetTime):
176 pushq %rbp // stack frame is for the debugger
177 movq %rsp, %rbp
178
179 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
180 pushq %rdi
181
182 movq %rcx, %rdi // Swizzle args
183 movq %rdx, %rsi
184
185 call ASM_PFX(SecGetTime)
186
187 popq %rdi // restore state
188 popq %rsi
189 popq %rbp
190 ret
191
192 ASM_GLOBAL ASM_PFX(GasketSecSetTime)
193 ASM_PFX(GasketSecSetTime):
194 pushq %rbp // stack frame is for the debugger
195 movq %rsp, %rbp
196
197 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
198 pushq %rdi
199
200 movq %rcx, %rdi // Swizzle args
201 movq %rdx, %rsi
202
203 call ASM_PFX(SecSetTime)
204
205 popq %rdi // restore state
206 popq %rsi
207 popq %rbp
208 ret
209
210
211 ASM_GLOBAL ASM_PFX(GasketSecGetNextProtocol)
212 ASM_PFX(GasketSecGetNextProtocol):
213 pushq %rbp // stack frame is for the debugger
214 movq %rsp, %rbp
215
216 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
217 pushq %rdi
218
219 movq %rcx, %rdi // Swizzle args
220 movq %rdx, %rsi
221 movq %r8, %rdx
222 movq %r9, %rcx
223
224 call ASM_PFX(SecGetNextProtocol)
225
226 popq %rdi // restore state
227 popq %rsi
228 popq %rbp
229 ret
230
231 // PPIs produced by SEC
232
233 ASM_GLOBAL ASM_PFX(GasketSecPeCoffGetEntryPoint)
234 ASM_PFX(GasketSecPeCoffGetEntryPoint):
235 pushq %rbp // stack frame is for the debugger
236 movq %rsp, %rbp
237
238 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
239 pushq %rdi
240
241 movq %rcx, %rdi // Swizzle args
242 movq %rdx, %rsi
243
244 call ASM_PFX(SecPeCoffGetEntryPoint)
245
246 popq %rdi // restore state
247 popq %rsi
248 popq %rbp
249 ret
250
251 ASM_GLOBAL ASM_PFX(GasketSecPeCoffRelocateImageExtraAction)
252 ASM_PFX(GasketSecPeCoffRelocateImageExtraAction):
253 pushq %rbp // stack frame is for the debugger
254 movq %rsp, %rbp
255
256 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
257 pushq %rdi
258
259 movq %rcx, %rdi // Swizzle args
260
261 call ASM_PFX(SecPeCoffRelocateImageExtraAction)
262
263 popq %rdi // restore state
264 popq %rsi
265 popq %rbp
266 ret
267
268 ASM_GLOBAL ASM_PFX(GasketSecPeCoffUnloadImageExtraAction)
269 ASM_PFX(GasketSecPeCoffUnloadImageExtraAction):
270 pushq %rbp // stack frame is for the debugger
271 movq %rsp, %rbp
272
273 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
274 pushq %rdi
275
276 movq %rcx, %rdi // Swizzle args
277
278 call ASM_PFX(SecPeCoffUnloadImageExtraAction)
279
280 popq %rdi // restore state
281 popq %rsi
282 popq %rbp
283 ret
284
285
286 ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress)
287 ASM_PFX(GasketSecEmuThunkAddress):
288 pushq %rbp // stack frame is for the debugger
289 movq %rsp, %rbp
290
291 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
292 pushq %rdi
293
294 call ASM_PFX(SecEmuThunkAddress)
295
296 popq %rdi // restore state
297 popq %rsi
298 popq %rbp
299 ret
300
301 //
302 // Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
303 //
304
305 ASM_GLOBAL ASM_PFX(GasketX11Size)
306 ASM_PFX(GasketX11Size):
307 pushq %rbp // stack frame is for the debugger
308 movq %rsp, %rbp
309
310 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
311 pushq %rdi
312
313 movq %rcx, %rdi // Swizzle args
314 movq %rdx, %rsi
315 movq %r8, %rdx
316 movq %r9, %rcx
317
318 call ASM_PFX(X11Size)
319
320 popq %rdi // restore state
321 popq %rsi
322 popq %rbp
323 ret
324
325
326 ASM_GLOBAL ASM_PFX(GasketX11CheckKey)
327 ASM_PFX(GasketX11CheckKey):
328 pushq %rbp // stack frame is for the debugger
329 movq %rsp, %rbp
330
331 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
332 pushq %rdi
333
334 movq %rcx, %rdi // Swizzle args
335
336 call ASM_PFX(X11CheckKey)
337
338 popq %rdi // restore state
339 popq %rsi
340 popq %rbp
341 ret
342
343 ASM_GLOBAL ASM_PFX(GasketX11GetKey)
344 ASM_PFX(GasketX11GetKey):
345 pushq %rbp // stack frame is for the debugger
346 movq %rsp, %rbp
347
348 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
349 pushq %rdi
350
351 movq %rcx, %rdi // Swizzle args
352 movq %rdx, %rsi
353
354 call ASM_PFX(X11GetKey)
355
356 popq %rdi // restore state
357 popq %rsi
358 popq %rbp
359 ret
360
361
362 ASM_GLOBAL ASM_PFX(GasketX11KeySetState)
363 ASM_PFX(GasketX11KeySetState):
364 pushq %rbp // stack frame is for the debugger
365 movq %rsp, %rbp
366
367 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
368 pushq %rdi
369
370 movq %rcx, %rdi // Swizzle args
371 movq %rdx, %rsi
372
373 call ASM_PFX(X11KeySetState)
374
375 popq %rdi // restore state
376 popq %rsi
377 popq %rbp
378 ret
379
380
381 ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify)
382 ASM_PFX(GasketX11RegisterKeyNotify):
383 pushq %rbp // stack frame is for the debugger
384 movq %rsp, %rbp
385
386 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
387 pushq %rdi
388
389 movq %rcx, %rdi // Swizzle args
390 movq %rdx, %rsi
391 movq %r8, %rdx
392 movq %r9, %rcx
393
394 call ASM_PFX(X11RegisterKeyNotify)
395
396 popq %rdi // restore state
397 popq %rsi
398 popq %rbp
399 ret
400
401
402 ASM_GLOBAL ASM_PFX(GasketX11Blt)
403 ASM_PFX(GasketX11Blt):
404 pushq %rbp // stack frame is for the debugger
405 movq %rsp, %rbp
406
407 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
408 pushq %rdi
409
410 movq %rcx, %rdi // Swizzle args
411 movq %rdx, %rsi
412 movq %r8, %rdx
413 movq %r9, %rcx
414
415 call ASM_PFX(X11Blt)
416
417 popq %rdi // restore state
418 popq %rsi
419 popq %rbp
420 ret
421
422
423 ASM_GLOBAL ASM_PFX(GasketX11CheckPointer)
424 ASM_PFX(GasketX11CheckPointer):
425 pushq %rbp // stack frame is for the debugger
426 movq %rsp, %rbp
427
428 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
429 pushq %rdi
430
431 movq %rcx, %rdi // Swizzle args
432
433 call ASM_PFX(X11CheckPointer)
434
435 popq %rdi // restore state
436 popq %rsi
437 popq %rbp
438 ret
439
440
441 ASM_GLOBAL ASM_PFX(GasketX11GetPointerState)
442 ASM_PFX(GasketX11GetPointerState):
443 pushq %rbp // stack frame is for the debugger
444 movq %rsp, %rbp
445
446 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
447 pushq %rdi
448
449 movq %rcx, %rdi // Swizzle args
450 movq %rdx, %rsi
451
452 call ASM_PFX(X11GetPointerState)
453
454 popq %rdi // restore state
455 popq %rsi
456 popq %rbp
457 ret
458
459
460 ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowOpen)
461 ASM_PFX(GasketX11GraphicsWindowOpen):
462 pushq %rbp // stack frame is for the debugger
463 movq %rsp, %rbp
464
465 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
466 pushq %rdi
467
468 movq %rcx, %rdi // Swizzle args
469
470 call ASM_PFX(X11GraphicsWindowOpen)
471
472 popq %rdi // restore state
473 popq %rsi
474 popq %rbp
475 ret
476
477
478 ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose)
479 ASM_PFX(GasketX11GraphicsWindowClose):
480 pushq %rbp // stack frame is for the debugger
481 movq %rsp, %rbp
482
483 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
484 pushq %rdi
485
486 movq %rcx, %rdi // Swizzle args
487 movq %r9, %rcx
488
489 call ASM_PFX(X11GraphicsWindowClose)
490
491 popq %rdi // restore state
492 popq %rsi
493 popq %rbp
494 ret
495
496
497 // Pthreads
498
499 ASM_GLOBAL ASM_PFX(GasketPthreadMutexLock)
500 ASM_PFX(GasketPthreadMutexLock):
501 pushq %rbp // stack frame is for the debugger
502 movq %rsp, %rbp
503
504 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
505 pushq %rdi
506
507 movq %rcx, %rdi // Swizzle args
508
509 call ASM_PFX(PthreadMutexLock)
510
511 popq %rdi // restore state
512 popq %rsi
513 popq %rbp
514 ret
515
516
517 ASM_GLOBAL ASM_PFX(GasketPthreadMutexUnLock)
518 ASM_PFX(GasketPthreadMutexUnLock):
519 pushq %rbp // stack frame is for the debugger
520 movq %rsp, %rbp
521
522 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
523 pushq %rdi
524
525 movq %rcx, %rdi // Swizzle args
526
527 call ASM_PFX(PthreadMutexUnLock)
528
529 popq %rdi // restore state
530 popq %rsi
531 popq %rbp
532 ret
533
534 ASM_GLOBAL ASM_PFX(GasketPthreadMutexTryLock)
535 ASM_PFX(GasketPthreadMutexTryLock):
536 pushq %rbp // stack frame is for the debugger
537 movq %rsp, %rbp
538
539 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
540 pushq %rdi
541
542 movq %rcx, %rdi // Swizzle args
543
544 call ASM_PFX(PthreadMutexTryLock)
545
546 popq %rdi // restore state
547 popq %rsi
548 popq %rbp
549 ret
550
551 ASM_GLOBAL ASM_PFX(GasketPthreadMutexInit)
552 ASM_PFX(GasketPthreadMutexInit):
553 pushq %rbp // stack frame is for the debugger
554 movq %rsp, %rbp
555
556 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
557 pushq %rdi
558
559
560 call ASM_PFX(PthreadMutexInit)
561
562 popq %rdi // restore state
563 popq %rsi
564 popq %rbp
565 ret
566
567
568
569 ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy)
570 ASM_PFX(GasketPthreadMutexDestroy):
571 pushq %rbp // stack frame is for the debugger
572 movq %rsp, %rbp
573
574 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
575 pushq %rdi
576
577 movq %rcx, %rdi // Swizzle args
578
579 call ASM_PFX(PthreadMutexDestroy)
580
581 popq %rdi // restore state
582 popq %rsi
583 popq %rbp
584 ret
585
586
587 ASM_GLOBAL ASM_PFX(GasketPthreadCreate)
588 ASM_PFX(GasketPthreadCreate):
589 pushq %rbp // stack frame is for the debugger
590 movq %rsp, %rbp
591
592 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
593 pushq %rdi
594
595 movq %rcx, %rdi // Swizzle args
596 movq %rdx, %rsi
597 movq %r8, %rdx
598 movq %r9, %rcx
599
600 call ASM_PFX(PthreadCreate)
601
602 popq %rdi // restore state
603 popq %rsi
604 popq %rbp
605 ret
606
607
608 ASM_GLOBAL ASM_PFX(GasketPthreadExit)
609 ASM_PFX(GasketPthreadExit):
610 pushq %rbp // stack frame is for the debugger
611 movq %rsp, %rbp
612
613 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
614 pushq %rdi
615
616 movq %rcx, %rdi // Swizzle args
617
618 call ASM_PFX(PthreadExit)
619
620 popq %rdi // restore state
621 popq %rsi
622 popq %rbp
623 ret
624
625
626
627 ASM_GLOBAL ASM_PFX(GasketPthreadSelf)
628 ASM_PFX(GasketPthreadSelf):
629 pushq %rbp // stack frame is for the debugger
630 movq %rsp, %rbp
631
632 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
633 pushq %rdi
634
635
636 call ASM_PFX(PthreadSelf)
637
638 popq %rdi // restore state
639 popq %rsi
640 popq %rbp
641 ret
642
643
644 ASM_GLOBAL ASM_PFX(GasketPthreadOpen)
645 ASM_PFX(GasketPthreadOpen):
646 pushq %rbp // stack frame is for the debugger
647 movq %rsp, %rbp
648
649 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
650 pushq %rdi
651
652 movq %rcx, %rdi // Swizzle args
653
654 call ASM_PFX(PthreadOpen)
655
656 popq %rdi // restore state
657 popq %rsi
658 popq %rbp
659 ret
660
661
662 ASM_GLOBAL ASM_PFX(GasketPthreadClose)
663 ASM_PFX(GasketPthreadClose):
664 pushq %rbp // stack frame is for the debugger
665 movq %rsp, %rbp
666
667 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
668 pushq %rdi
669
670 movq %rcx, %rdi // Swizzle args
671
672 call ASM_PFX(PthreadClose)
673
674 popq %rdi // restore state
675 popq %rsi
676 popq %rbp
677 ret
678
679
680
681
682 //
683 // UNIX ABI to EFI ABI call
684 //
685 // UINTN
686 // ReverseGasketUint64 (
687 // void *Api,
688 // UINTN Arg1
689 // );
690 ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
691 ASM_PFX(ReverseGasketUint64):
692 pushq %rbp // stack frame is for the debugger
693 movq %rsp, %rbp
694
695 movq %rdi, %rax // Swizzle args
696 movq %rsi, %rcx
697
698 subq $32, %rsp // 32-byte shadow space
699 call *%rax
700 addq $32, %rsp
701
702 popq %rbp
703 ret
704
705 //
706 // UNIX ABI to EFI ABI call
707 //
708 // UINTN
709 // ReverseGasketUint64Uint64 (
710 // void *Api,
711 // UINTN Arg1
712 // UINTN Arg2
713 // );
714 ASM_GLOBAL ASM_PFX(ReverseGasketUint64Uint64)
715 ASM_PFX(ReverseGasketUint64Uint64):
716 pushq %rbp // stack frame is for the debugger
717 movq %rsp, %rbp
718
719 movq %rdi, %rax // Swizzle args
720 movq %rsi, %rcx
721
722 subq $32, %rsp // 32-byte shadow space
723 call *%rax
724 addq $32, %rsp
725
726 popq %rbp
727 ret
728
729
730 // Sec PPI Callbacks - Check Me
731
732 ASM_GLOBAL ASM_PFX(GasketSecUnixPeiLoadFile)
733 ASM_PFX(GasketSecUnixPeiLoadFile):
734 pushq %rbp // stack frame is for the debugger
735 movq %rsp, %rbp
736
737 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
738 pushq %rdi
739
740 movq %rcx, %rdi // Swizzle args
741 movq %rdx, %rsi
742 movq %r8, %rdx
743 movq %r9, %rcx
744
745 call ASM_PFX(SecUnixPeiLoadFile)
746
747 popq %rdi // restore state
748 popq %rsi
749 popq %rbp
750 ret
751
752
753
754 ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
755 ASM_PFX(GasketSecUnixPeiAutoScan):
756 pushq %rbp // stack frame is for the debugger
757 movq %rsp, %rbp
758
759 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
760 pushq %rdi
761
762 movq %rcx, %rdi // Swizzle args
763 movq %rdx, %rsi
764 movq %r8, %rdx
765
766 call ASM_PFX(SecUnixPeiAutoScan)
767
768 popq %rdi // restore state
769 popq %rsi
770 popq %rbp
771 ret
772
773
774 ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
775 ASM_PFX(GasketSecUnixFdAddress):
776 pushq %rbp // stack frame is for the debugger
777 movq %rsp, %rbp
778
779 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
780 pushq %rdi
781
782 movq %rcx, %rdi // Swizzle args
783 movq %rdx, %rsi
784 movq %r8, %rdx
785 movq %r9, %rcx
786
787 call ASM_PFX(SecUnixFdAddress)
788
789 popq %rdi // restore state
790 popq %rsi
791 popq %rbp
792 ret
793
794
795 // EmuIoThunk SimpleFileSystem
796
797 ASM_GLOBAL ASM_PFX(GasketPosixOpenVolume)
798 ASM_PFX(GasketPosixOpenVolume):
799 pushq %rbp // stack frame is for the debugger
800 movq %rsp, %rbp
801
802 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
803 pushq %rdi
804
805 movq %rcx, %rdi // Swizzle args
806 movq %rdx, %rsi
807 movq %r8, %rdx
808 movq %r9, %rcx
809
810 call ASM_PFX(PosixOpenVolume)
811
812 popq %rdi // restore state
813 popq %rsi
814 popq %rbp
815 ret
816
817
818 ASM_GLOBAL ASM_PFX(GasketPosixFileOpen)
819 ASM_PFX(GasketPosixFileOpen):
820 pushq %rbp // stack frame is for the debugger
821 movq %rsp, %rbp
822
823 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
824 pushq %rdi
825
826 movq %rcx, %rdi // Swizzle args
827 movq %rdx, %rsi
828 movq %r8, %rdx
829 movq %r9, %rcx
830 movq 0x30(%rbp), %r8
831
832 call ASM_PFX(PosixFileOpen)
833
834 popq %rdi // restore state
835 popq %rsi
836 popq %rbp
837 ret
838
839
840 ASM_GLOBAL ASM_PFX(GasketPosixFileCLose)
841 ASM_PFX(GasketPosixFileCLose):
842 pushq %rbp // stack frame is for the debugger
843 movq %rsp, %rbp
844
845 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
846 pushq %rdi
847
848 movq %rcx, %rdi // Swizzle args
849
850 call ASM_PFX(PosixFileCLose)
851
852 popq %rdi // restore state
853 popq %rsi
854 popq %rbp
855 ret
856
857
858 ASM_GLOBAL ASM_PFX(GasketPosixFileDelete)
859 ASM_PFX(GasketPosixFileDelete):
860 pushq %rbp // stack frame is for the debugger
861 movq %rsp, %rbp
862
863 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
864 pushq %rdi
865
866 movq %rcx, %rdi // Swizzle args
867
868 call ASM_PFX(PosixFileDelete)
869
870 popq %rdi // restore state
871 popq %rsi
872 popq %rbp
873 ret
874
875
876 ASM_GLOBAL ASM_PFX(GasketPosixFileRead)
877 ASM_PFX(GasketPosixFileRead):
878 pushq %rbp // stack frame is for the debugger
879 movq %rsp, %rbp
880
881 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
882 pushq %rdi
883
884 movq %rcx, %rdi // Swizzle args
885 movq %rdx, %rsi
886 movq %r8, %rdx
887
888 call ASM_PFX(PosixFileRead)
889
890 popq %rdi // restore state
891 popq %rsi
892 popq %rbp
893 ret
894
895
896 ASM_GLOBAL ASM_PFX(GasketPosixFileWrite)
897 ASM_PFX(GasketPosixFileWrite):
898 pushq %rbp // stack frame is for the debugger
899 movq %rsp, %rbp
900
901 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
902 pushq %rdi
903
904 movq %rcx, %rdi // Swizzle args
905 movq %rdx, %rsi
906 movq %r8, %rdx
907
908 call ASM_PFX(PosixFileWrite)
909
910 popq %rdi // restore state
911 popq %rsi
912 popq %rbp
913 ret
914
915
916 ASM_GLOBAL ASM_PFX(GasketPosixFileSetPossition)
917 ASM_PFX(GasketPosixFileSetPossition):
918 pushq %rbp // stack frame is for the debugger
919 movq %rsp, %rbp
920
921 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
922 pushq %rdi
923
924 movq %rcx, %rdi // Swizzle args
925 movq %rdx, %rsi
926
927 call ASM_PFX(PosixFileSetPossition)
928
929 popq %rdi // restore state
930 popq %rsi
931 popq %rbp
932 ret
933
934
935 ASM_GLOBAL ASM_PFX(GasketPosixFileGetPossition)
936 ASM_PFX(GasketPosixFileGetPossition):
937 pushq %rbp // stack frame is for the debugger
938 movq %rsp, %rbp
939
940 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
941 pushq %rdi
942
943 movq %rcx, %rdi // Swizzle args
944 movq %rdx, %rsi
945
946 call ASM_PFX(PosixFileGetPossition)
947
948 popq %rdi // restore state
949 popq %rsi
950 popq %rbp
951 ret
952
953
954 ASM_GLOBAL ASM_PFX(GasketPosixFileGetInfo)
955 ASM_PFX(GasketPosixFileGetInfo):
956 pushq %rbp // stack frame is for the debugger
957 movq %rsp, %rbp
958
959 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
960 pushq %rdi
961
962 movq %rcx, %rdi // Swizzle args
963 movq %rdx, %rsi
964 movq %r8, %rdx
965 movq %r9, %rcx
966
967 call ASM_PFX(PosixFileGetInfo)
968
969 popq %rdi // restore state
970 popq %rsi
971 popq %rbp
972 ret
973
974
975 ASM_GLOBAL ASM_PFX(GasketPosixFileSetInfo)
976 ASM_PFX(GasketPosixFileSetInfo):
977 pushq %rbp // stack frame is for the debugger
978 movq %rsp, %rbp
979
980 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
981 pushq %rdi
982
983 movq %rcx, %rdi // Swizzle args
984 movq %rdx, %rsi
985 movq %r8, %rdx
986 movq %r9, %rcx
987
988 call ASM_PFX(PosixFileSetInfo)
989
990 popq %rdi // restore state
991 popq %rsi
992 popq %rbp
993 ret
994
995
996 ASM_GLOBAL ASM_PFX(GasketPosixFileFlush)
997 ASM_PFX(GasketPosixFileFlush):
998 pushq %rbp // stack frame is for the debugger
999 movq %rsp, %rbp
1000
1001 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1002 pushq %rdi
1003
1004 movq %rcx, %rdi // Swizzle args
1005
1006 call ASM_PFX(PosixFileFlush)
1007
1008 popq %rdi // restore state
1009 popq %rsi
1010 popq %rbp
1011 ret
1012
1013
1014 ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkOpen)
1015 ASM_PFX(GasketPosixFileSystmeThunkOpen):
1016 pushq %rbp // stack frame is for the debugger
1017 movq %rsp, %rbp
1018
1019 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1020 pushq %rdi
1021
1022 movq %rcx, %rdi // Swizzle args
1023
1024 call ASM_PFX(PosixFileSystmeThunkOpen)
1025
1026 popq %rdi // restore state
1027 popq %rsi
1028 popq %rbp
1029 ret
1030
1031
1032 ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkClose)
1033 ASM_PFX(GasketPosixFileSystmeThunkClose):
1034 pushq %rbp // stack frame is for the debugger
1035 movq %rsp, %rbp
1036
1037 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1038 pushq %rdi
1039
1040 movq %rcx, %rdi // Swizzle args
1041
1042 call ASM_PFX(PosixFileSystmeThunkClose)
1043
1044 popq %rdi // restore state
1045 popq %rsi
1046 popq %rbp
1047 ret
1048
1049
1050
1051
1052
1053
1054