]> git.proxmox.com Git - mirror_edk2.git/blame - InOsEmuPkg/Unix/Sec/X64/Gasket.S
[InOSEmPkg] Add OS malloc and free to the Thunk.
[mirror_edk2.git] / InOsEmuPkg / Unix / Sec / X64 / Gasket.S
CommitLineData
949f388f 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
44ASM_GLOBAL ASM_PFX(GasketSecWriteStdErr)
45ASM_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
7e284acb 63ASM_GLOBAL ASM_PFX(GasketSecConfigStdIn)
64ASM_PFX(GasketSecConfigStdIn):
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 call ASM_PFX(SecConfigStdIn)
72
73 popq %rdi // restore state
74 popq %rsi
75 popq %rbp
76 ret
77
78ASM_GLOBAL ASM_PFX(GasketSecWriteStdOut)
79ASM_PFX(GasketSecWriteStdOut):
80 pushq %rbp // stack frame is for the debugger
81 movq %rsp, %rbp
82
83 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
84 pushq %rdi
85
86 movq %rcx, %rdi // Swizzle args
87 movq %rdx, %rsi
88
89 call ASM_PFX(SecWriteStdOut)
90
91 popq %rdi // restore state
92 popq %rsi
93 popq %rbp
94 ret
95
96ASM_GLOBAL ASM_PFX(GasketSecReadStdIn)
97ASM_PFX(GasketSecReadStdIn):
98 pushq %rbp // stack frame is for the debugger
99 movq %rsp, %rbp
100
101 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
102 pushq %rdi
103
104 movq %rcx, %rdi // Swizzle args
105 movq %rdx, %rsi
106
107 call ASM_PFX(SecReadStdIn)
108
109 popq %rdi // restore state
110 popq %rsi
111 popq %rbp
112 ret
113
114ASM_GLOBAL ASM_PFX(GasketSecPollStdIn)
115ASM_PFX(GasketSecPollStdIn):
116 pushq %rbp // stack frame is for the debugger
117 movq %rsp, %rbp
118
119 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
120 pushq %rdi
121
122 call ASM_PFX(SecPollStdIn)
123
124 popq %rdi // restore state
125 popq %rsi
126 popq %rbp
127 ret
128
c2175068 129ASM_GLOBAL ASM_PFX(GasketSecMalloc)
130ASM_PFX(GasketSecMalloc):
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
136 call ASM_PFX(SecMalloc)
137
138 popq %rdi // restore state
139 popq %rsi
140 popq %rbp
141 ret
142
143ASM_GLOBAL ASM_PFX(GasketSecFree)
144ASM_PFX(GasketSecFree):
145 pushq %rbp // stack frame is for the debugger
146 movq %rsp, %rbp
147
148 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
149
150 call ASM_PFX(SecFree)
151
152 popq %rdi // restore state
153 popq %rsi
154 popq %rbp
155 ret
156
7e284acb 157
949f388f 158ASM_GLOBAL ASM_PFX(GasketSecSetTimer)
159ASM_PFX(GasketSecSetTimer):
160 pushq %rbp // stack frame is for the debugger
161 movq %rsp, %rbp
162
163 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
164 pushq %rdi
165
166 movq %rcx, %rdi // Swizzle args
167 movq %rdx, %rsi
168
169 call ASM_PFX(SecSetTimer)
170
171 popq %rdi // restore state
172 popq %rsi
173 popq %rbp
174 ret
175
176
177ASM_GLOBAL ASM_PFX(GasketSecEnableInterrupt)
178ASM_PFX(GasketSecEnableInterrupt):
179 pushq %rbp // stack frame is for the debugger
180 movq %rsp, %rbp
181
182 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
183 pushq %rdi
184
185 call ASM_PFX(SecEnableInterrupt)
186
187 popq %rdi // restore state
188 popq %rsi
189 popq %rbp
190 ret
191
192
193ASM_GLOBAL ASM_PFX(GasketSecDisableInterrupt)
194ASM_PFX(GasketSecDisableInterrupt):
195 pushq %rbp // stack frame is for the debugger
196 movq %rsp, %rbp
197
198 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
199 pushq %rdi
200
201 call ASM_PFX(SecDisableInterrupt)
202
203 popq %rdi // restore state
204 popq %rsi
205 popq %rbp
206 ret
207
208ASM_GLOBAL ASM_PFX(GasketQueryPerformanceFrequency)
209ASM_PFX(GasketQueryPerformanceFrequency):
210 pushq %rbp // stack frame is for the debugger
211 movq %rsp, %rbp
212
213 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
214 pushq %rdi
215
216 call ASM_PFX(QueryPerformanceFrequency)
217
218 popq %rdi // restore state
219 popq %rsi
220 popq %rbp
221 ret
222
223
224ASM_GLOBAL ASM_PFX(GasketQueryPerformanceCounter)
225ASM_PFX(GasketQueryPerformanceCounter):
226 pushq %rbp // stack frame is for the debugger
227 movq %rsp, %rbp
228
229 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
230 pushq %rdi
231
232 call ASM_PFX(QueryPerformanceCounter)
233
234 popq %rdi // restore state
235 popq %rsi
236 popq %rbp
237 ret
238
239
240ASM_GLOBAL ASM_PFX(GasketSecSleep)
241ASM_PFX(GasketSecSleep):
242 pushq %rbp // stack frame is for the debugger
243 movq %rsp, %rbp
244
245 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
246 pushq %rdi
247
248 movq %rcx, %rdi // Swizzle args
249
250 call ASM_PFX(SecSleep)
251
252 popq %rdi // restore state
253 popq %rsi
254 popq %rbp
255 ret
256
257
57c7d70f 258ASM_GLOBAL ASM_PFX(GasketSecCpuSleep)
259ASM_PFX(GasketSecCpuSleep):
260 pushq %rbp // stack frame is for the debugger
261 movq %rsp, %rbp
262
263 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
264 pushq %rdi
265
266 call ASM_PFX(SecCpuSleep)
267
268 popq %rdi // restore state
269 popq %rsi
270 popq %rbp
271 ret
272
273
949f388f 274ASM_GLOBAL ASM_PFX(GasketSecExit)
275ASM_PFX(GasketSecExit):
276 pushq %rbp // stack frame is for the debugger
277 movq %rsp, %rbp
278
279 movq %rcx, %rdi // Swizzle args
280 call ASM_PFX(SecExit) // Less to do as we will never return to EFI ABI world
281LDEAD_LOOP:
282 jmp LDEAD_LOOP // _exit should never return
283
284
285ASM_GLOBAL ASM_PFX(GasketSecGetTime)
286ASM_PFX(GasketSecGetTime):
287 pushq %rbp // stack frame is for the debugger
288 movq %rsp, %rbp
289
290 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
291 pushq %rdi
292
293 movq %rcx, %rdi // Swizzle args
294 movq %rdx, %rsi
295
296 call ASM_PFX(SecGetTime)
297
298 popq %rdi // restore state
299 popq %rsi
300 popq %rbp
301 ret
302
303ASM_GLOBAL ASM_PFX(GasketSecSetTime)
304ASM_PFX(GasketSecSetTime):
305 pushq %rbp // stack frame is for the debugger
306 movq %rsp, %rbp
307
308 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
309 pushq %rdi
310
311 movq %rcx, %rdi // Swizzle args
312 movq %rdx, %rsi
313
314 call ASM_PFX(SecSetTime)
315
316 popq %rdi // restore state
317 popq %rsi
318 popq %rbp
319 ret
320
321
322ASM_GLOBAL ASM_PFX(GasketSecGetNextProtocol)
323ASM_PFX(GasketSecGetNextProtocol):
324 pushq %rbp // stack frame is for the debugger
325 movq %rsp, %rbp
326
327 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
328 pushq %rdi
329
330 movq %rcx, %rdi // Swizzle args
331 movq %rdx, %rsi
332 movq %r8, %rdx
333 movq %r9, %rcx
334
335 call ASM_PFX(SecGetNextProtocol)
336
337 popq %rdi // restore state
338 popq %rsi
339 popq %rbp
340 ret
341
342// PPIs produced by SEC
343
344ASM_GLOBAL ASM_PFX(GasketSecPeCoffGetEntryPoint)
345ASM_PFX(GasketSecPeCoffGetEntryPoint):
346 pushq %rbp // stack frame is for the debugger
347 movq %rsp, %rbp
348
349 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
350 pushq %rdi
351
352 movq %rcx, %rdi // Swizzle args
353 movq %rdx, %rsi
354
355 call ASM_PFX(SecPeCoffGetEntryPoint)
356
357 popq %rdi // restore state
358 popq %rsi
359 popq %rbp
360 ret
361
362ASM_GLOBAL ASM_PFX(GasketSecPeCoffRelocateImageExtraAction)
363ASM_PFX(GasketSecPeCoffRelocateImageExtraAction):
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
372 call ASM_PFX(SecPeCoffRelocateImageExtraAction)
373
374 popq %rdi // restore state
375 popq %rsi
376 popq %rbp
377 ret
378
379ASM_GLOBAL ASM_PFX(GasketSecPeCoffUnloadImageExtraAction)
380ASM_PFX(GasketSecPeCoffUnloadImageExtraAction):
381 pushq %rbp // stack frame is for the debugger
382 movq %rsp, %rbp
383
384 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
385 pushq %rdi
386
387 movq %rcx, %rdi // Swizzle args
388
389 call ASM_PFX(SecPeCoffUnloadImageExtraAction)
390
391 popq %rdi // restore state
392 popq %rsi
393 popq %rbp
394 ret
395
396
397ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress)
398ASM_PFX(GasketSecEmuThunkAddress):
399 pushq %rbp // stack frame is for the debugger
400 movq %rsp, %rbp
401
402 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
403 pushq %rdi
404
405 call ASM_PFX(SecEmuThunkAddress)
406
407 popq %rdi // restore state
408 popq %rsi
409 popq %rbp
410 ret
411
412//
413// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
414//
415
416ASM_GLOBAL ASM_PFX(GasketX11Size)
417ASM_PFX(GasketX11Size):
418 pushq %rbp // stack frame is for the debugger
419 movq %rsp, %rbp
420
421 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
422 pushq %rdi
423
424 movq %rcx, %rdi // Swizzle args
425 movq %rdx, %rsi
426 movq %r8, %rdx
427 movq %r9, %rcx
428
429 call ASM_PFX(X11Size)
430
431 popq %rdi // restore state
432 popq %rsi
433 popq %rbp
434 ret
435
436
437ASM_GLOBAL ASM_PFX(GasketX11CheckKey)
438ASM_PFX(GasketX11CheckKey):
439 pushq %rbp // stack frame is for the debugger
440 movq %rsp, %rbp
441
442 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
443 pushq %rdi
444
445 movq %rcx, %rdi // Swizzle args
446
447 call ASM_PFX(X11CheckKey)
448
449 popq %rdi // restore state
450 popq %rsi
451 popq %rbp
452 ret
453
454ASM_GLOBAL ASM_PFX(GasketX11GetKey)
455ASM_PFX(GasketX11GetKey):
456 pushq %rbp // stack frame is for the debugger
457 movq %rsp, %rbp
458
459 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
460 pushq %rdi
461
462 movq %rcx, %rdi // Swizzle args
463 movq %rdx, %rsi
464
465 call ASM_PFX(X11GetKey)
466
467 popq %rdi // restore state
468 popq %rsi
469 popq %rbp
470 ret
471
472
473ASM_GLOBAL ASM_PFX(GasketX11KeySetState)
474ASM_PFX(GasketX11KeySetState):
475 pushq %rbp // stack frame is for the debugger
476 movq %rsp, %rbp
477
478 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
479 pushq %rdi
480
481 movq %rcx, %rdi // Swizzle args
482 movq %rdx, %rsi
483
484 call ASM_PFX(X11KeySetState)
485
486 popq %rdi // restore state
487 popq %rsi
488 popq %rbp
489 ret
490
491
492ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify)
493ASM_PFX(GasketX11RegisterKeyNotify):
494 pushq %rbp // stack frame is for the debugger
495 movq %rsp, %rbp
496
497 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
498 pushq %rdi
499
500 movq %rcx, %rdi // Swizzle args
501 movq %rdx, %rsi
502 movq %r8, %rdx
503 movq %r9, %rcx
504
505 call ASM_PFX(X11RegisterKeyNotify)
506
507 popq %rdi // restore state
508 popq %rsi
509 popq %rbp
510 ret
511
512
513ASM_GLOBAL ASM_PFX(GasketX11Blt)
514ASM_PFX(GasketX11Blt):
515 pushq %rbp // stack frame is for the debugger
516 movq %rsp, %rbp
517
518 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
519 pushq %rdi
520
521 movq %rcx, %rdi // Swizzle args
522 movq %rdx, %rsi
523 movq %r8, %rdx
524 movq %r9, %rcx
525
526 call ASM_PFX(X11Blt)
527
528 popq %rdi // restore state
529 popq %rsi
530 popq %rbp
531 ret
532
533
534ASM_GLOBAL ASM_PFX(GasketX11CheckPointer)
535ASM_PFX(GasketX11CheckPointer):
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(X11CheckPointer)
545
546 popq %rdi // restore state
547 popq %rsi
548 popq %rbp
549 ret
550
551
552ASM_GLOBAL ASM_PFX(GasketX11GetPointerState)
553ASM_PFX(GasketX11GetPointerState):
554 pushq %rbp // stack frame is for the debugger
555 movq %rsp, %rbp
556
557 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
558 pushq %rdi
559
560 movq %rcx, %rdi // Swizzle args
561 movq %rdx, %rsi
562
563 call ASM_PFX(X11GetPointerState)
564
565 popq %rdi // restore state
566 popq %rsi
567 popq %rbp
568 ret
569
570
571ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowOpen)
572ASM_PFX(GasketX11GraphicsWindowOpen):
573 pushq %rbp // stack frame is for the debugger
574 movq %rsp, %rbp
575
576 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
577 pushq %rdi
578
579 movq %rcx, %rdi // Swizzle args
580
581 call ASM_PFX(X11GraphicsWindowOpen)
582
583 popq %rdi // restore state
584 popq %rsi
585 popq %rbp
586 ret
587
588
589ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose)
590ASM_PFX(GasketX11GraphicsWindowClose):
591 pushq %rbp // stack frame is for the debugger
592 movq %rsp, %rbp
593
594 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
595 pushq %rdi
596
597 movq %rcx, %rdi // Swizzle args
598 movq %r9, %rcx
599
600 call ASM_PFX(X11GraphicsWindowClose)
601
602 popq %rdi // restore state
603 popq %rsi
604 popq %rbp
605 ret
606
607
608// Pthreads
609
610ASM_GLOBAL ASM_PFX(GasketPthreadMutexLock)
611ASM_PFX(GasketPthreadMutexLock):
612 pushq %rbp // stack frame is for the debugger
613 movq %rsp, %rbp
614
615 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
616 pushq %rdi
617
618 movq %rcx, %rdi // Swizzle args
619
620 call ASM_PFX(PthreadMutexLock)
621
622 popq %rdi // restore state
623 popq %rsi
624 popq %rbp
625 ret
626
627
628ASM_GLOBAL ASM_PFX(GasketPthreadMutexUnLock)
629ASM_PFX(GasketPthreadMutexUnLock):
630 pushq %rbp // stack frame is for the debugger
631 movq %rsp, %rbp
632
633 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
634 pushq %rdi
635
636 movq %rcx, %rdi // Swizzle args
637
638 call ASM_PFX(PthreadMutexUnLock)
639
640 popq %rdi // restore state
641 popq %rsi
642 popq %rbp
643 ret
644
645ASM_GLOBAL ASM_PFX(GasketPthreadMutexTryLock)
646ASM_PFX(GasketPthreadMutexTryLock):
647 pushq %rbp // stack frame is for the debugger
648 movq %rsp, %rbp
649
650 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
651 pushq %rdi
652
653 movq %rcx, %rdi // Swizzle args
654
655 call ASM_PFX(PthreadMutexTryLock)
656
657 popq %rdi // restore state
658 popq %rsi
659 popq %rbp
660 ret
661
662ASM_GLOBAL ASM_PFX(GasketPthreadMutexInit)
663ASM_PFX(GasketPthreadMutexInit):
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
671 call ASM_PFX(PthreadMutexInit)
672
673 popq %rdi // restore state
674 popq %rsi
675 popq %rbp
676 ret
677
678
679
680ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy)
681ASM_PFX(GasketPthreadMutexDestroy):
682 pushq %rbp // stack frame is for the debugger
683 movq %rsp, %rbp
684
685 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
686 pushq %rdi
687
688 movq %rcx, %rdi // Swizzle args
689
690 call ASM_PFX(PthreadMutexDestroy)
691
692 popq %rdi // restore state
693 popq %rsi
694 popq %rbp
695 ret
696
697
698ASM_GLOBAL ASM_PFX(GasketPthreadCreate)
699ASM_PFX(GasketPthreadCreate):
700 pushq %rbp // stack frame is for the debugger
701 movq %rsp, %rbp
702
703 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
704 pushq %rdi
705
706 movq %rcx, %rdi // Swizzle args
707 movq %rdx, %rsi
708 movq %r8, %rdx
709 movq %r9, %rcx
710
711 call ASM_PFX(PthreadCreate)
712
713 popq %rdi // restore state
714 popq %rsi
715 popq %rbp
716 ret
717
718
719ASM_GLOBAL ASM_PFX(GasketPthreadExit)
720ASM_PFX(GasketPthreadExit):
721 pushq %rbp // stack frame is for the debugger
722 movq %rsp, %rbp
723
724 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
725 pushq %rdi
726
727 movq %rcx, %rdi // Swizzle args
728
729 call ASM_PFX(PthreadExit)
730
731 popq %rdi // restore state
732 popq %rsi
733 popq %rbp
734 ret
735
736
737
738ASM_GLOBAL ASM_PFX(GasketPthreadSelf)
739ASM_PFX(GasketPthreadSelf):
740 pushq %rbp // stack frame is for the debugger
741 movq %rsp, %rbp
742
743 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
744 pushq %rdi
745
746
747 call ASM_PFX(PthreadSelf)
748
749 popq %rdi // restore state
750 popq %rsi
751 popq %rbp
752 ret
753
754
755ASM_GLOBAL ASM_PFX(GasketPthreadOpen)
756ASM_PFX(GasketPthreadOpen):
757 pushq %rbp // stack frame is for the debugger
758 movq %rsp, %rbp
759
760 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
761 pushq %rdi
762
763 movq %rcx, %rdi // Swizzle args
764
765 call ASM_PFX(PthreadOpen)
766
767 popq %rdi // restore state
768 popq %rsi
769 popq %rbp
770 ret
771
772
773ASM_GLOBAL ASM_PFX(GasketPthreadClose)
774ASM_PFX(GasketPthreadClose):
775 pushq %rbp // stack frame is for the debugger
776 movq %rsp, %rbp
777
778 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
779 pushq %rdi
780
781 movq %rcx, %rdi // Swizzle args
782
783 call ASM_PFX(PthreadClose)
784
785 popq %rdi // restore state
786 popq %rsi
787 popq %rbp
788 ret
789
790
791
792
793//
794// UNIX ABI to EFI ABI call
795//
796// UINTN
797// ReverseGasketUint64 (
798// void *Api,
799// UINTN Arg1
800// );
801ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
802ASM_PFX(ReverseGasketUint64):
803 pushq %rbp // stack frame is for the debugger
804 movq %rsp, %rbp
805
806 movq %rdi, %rax // Swizzle args
807 movq %rsi, %rcx
808
809 subq $32, %rsp // 32-byte shadow space
810 call *%rax
811 addq $32, %rsp
812
813 popq %rbp
814 ret
815
816//
817// UNIX ABI to EFI ABI call
818//
819// UINTN
820// ReverseGasketUint64Uint64 (
821// void *Api,
822// UINTN Arg1
823// UINTN Arg2
824// );
825ASM_GLOBAL ASM_PFX(ReverseGasketUint64Uint64)
826ASM_PFX(ReverseGasketUint64Uint64):
827 pushq %rbp // stack frame is for the debugger
828 movq %rsp, %rbp
829
830 movq %rdi, %rax // Swizzle args
831 movq %rsi, %rcx
832
833 subq $32, %rsp // 32-byte shadow space
834 call *%rax
835 addq $32, %rsp
836
837 popq %rbp
838 ret
839
840
949f388f 841ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
842ASM_PFX(GasketSecUnixPeiAutoScan):
843 pushq %rbp // stack frame is for the debugger
844 movq %rsp, %rbp
845
846 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
847 pushq %rdi
848
849 movq %rcx, %rdi // Swizzle args
850 movq %rdx, %rsi
851 movq %r8, %rdx
852
853 call ASM_PFX(SecUnixPeiAutoScan)
854
855 popq %rdi // restore state
856 popq %rsi
857 popq %rbp
858 ret
859
860
861ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
862ASM_PFX(GasketSecUnixFdAddress):
863 pushq %rbp // stack frame is for the debugger
864 movq %rsp, %rbp
865
866 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
867 pushq %rdi
868
869 movq %rcx, %rdi // Swizzle args
870 movq %rdx, %rsi
871 movq %r8, %rdx
872 movq %r9, %rcx
873
874 call ASM_PFX(SecUnixFdAddress)
875
876 popq %rdi // restore state
877 popq %rsi
878 popq %rbp
879 ret
880
881
882// EmuIoThunk SimpleFileSystem
883
884ASM_GLOBAL ASM_PFX(GasketPosixOpenVolume)
885ASM_PFX(GasketPosixOpenVolume):
886 pushq %rbp // stack frame is for the debugger
887 movq %rsp, %rbp
888
889 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
890 pushq %rdi
891
892 movq %rcx, %rdi // Swizzle args
893 movq %rdx, %rsi
894 movq %r8, %rdx
895 movq %r9, %rcx
896
897 call ASM_PFX(PosixOpenVolume)
898
899 popq %rdi // restore state
900 popq %rsi
901 popq %rbp
902 ret
903
904
905ASM_GLOBAL ASM_PFX(GasketPosixFileOpen)
906ASM_PFX(GasketPosixFileOpen):
907 pushq %rbp // stack frame is for the debugger
908 movq %rsp, %rbp
909
910 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
911 pushq %rdi
912
913 movq %rcx, %rdi // Swizzle args
914 movq %rdx, %rsi
915 movq %r8, %rdx
916 movq %r9, %rcx
2b59fcd5 917 movq 48(%rbp), %r8
949f388f 918
919 call ASM_PFX(PosixFileOpen)
920
921 popq %rdi // restore state
922 popq %rsi
923 popq %rbp
924 ret
925
926
927ASM_GLOBAL ASM_PFX(GasketPosixFileCLose)
928ASM_PFX(GasketPosixFileCLose):
929 pushq %rbp // stack frame is for the debugger
930 movq %rsp, %rbp
931
932 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
933 pushq %rdi
934
935 movq %rcx, %rdi // Swizzle args
936
937 call ASM_PFX(PosixFileCLose)
938
939 popq %rdi // restore state
940 popq %rsi
941 popq %rbp
942 ret
943
944
945ASM_GLOBAL ASM_PFX(GasketPosixFileDelete)
946ASM_PFX(GasketPosixFileDelete):
947 pushq %rbp // stack frame is for the debugger
948 movq %rsp, %rbp
949
950 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
951 pushq %rdi
952
953 movq %rcx, %rdi // Swizzle args
954
955 call ASM_PFX(PosixFileDelete)
956
957 popq %rdi // restore state
958 popq %rsi
959 popq %rbp
960 ret
961
962
963ASM_GLOBAL ASM_PFX(GasketPosixFileRead)
964ASM_PFX(GasketPosixFileRead):
965 pushq %rbp // stack frame is for the debugger
966 movq %rsp, %rbp
967
968 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
969 pushq %rdi
970
971 movq %rcx, %rdi // Swizzle args
972 movq %rdx, %rsi
973 movq %r8, %rdx
974
975 call ASM_PFX(PosixFileRead)
976
977 popq %rdi // restore state
978 popq %rsi
979 popq %rbp
980 ret
981
982
983ASM_GLOBAL ASM_PFX(GasketPosixFileWrite)
984ASM_PFX(GasketPosixFileWrite):
985 pushq %rbp // stack frame is for the debugger
986 movq %rsp, %rbp
987
988 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
989 pushq %rdi
990
991 movq %rcx, %rdi // Swizzle args
992 movq %rdx, %rsi
993 movq %r8, %rdx
994
995 call ASM_PFX(PosixFileWrite)
996
997 popq %rdi // restore state
998 popq %rsi
999 popq %rbp
1000 ret
1001
1002
1003ASM_GLOBAL ASM_PFX(GasketPosixFileSetPossition)
1004ASM_PFX(GasketPosixFileSetPossition):
1005 pushq %rbp // stack frame is for the debugger
1006 movq %rsp, %rbp
1007
1008 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1009 pushq %rdi
1010
1011 movq %rcx, %rdi // Swizzle args
1012 movq %rdx, %rsi
1013
1014 call ASM_PFX(PosixFileSetPossition)
1015
1016 popq %rdi // restore state
1017 popq %rsi
1018 popq %rbp
1019 ret
1020
1021
1022ASM_GLOBAL ASM_PFX(GasketPosixFileGetPossition)
1023ASM_PFX(GasketPosixFileGetPossition):
1024 pushq %rbp // stack frame is for the debugger
1025 movq %rsp, %rbp
1026
1027 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1028 pushq %rdi
1029
1030 movq %rcx, %rdi // Swizzle args
1031 movq %rdx, %rsi
1032
1033 call ASM_PFX(PosixFileGetPossition)
1034
1035 popq %rdi // restore state
1036 popq %rsi
1037 popq %rbp
1038 ret
1039
1040
1041ASM_GLOBAL ASM_PFX(GasketPosixFileGetInfo)
1042ASM_PFX(GasketPosixFileGetInfo):
1043 pushq %rbp // stack frame is for the debugger
1044 movq %rsp, %rbp
1045
1046 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1047 pushq %rdi
1048
1049 movq %rcx, %rdi // Swizzle args
1050 movq %rdx, %rsi
1051 movq %r8, %rdx
1052 movq %r9, %rcx
1053
1054 call ASM_PFX(PosixFileGetInfo)
1055
1056 popq %rdi // restore state
1057 popq %rsi
1058 popq %rbp
1059 ret
1060
1061
1062ASM_GLOBAL ASM_PFX(GasketPosixFileSetInfo)
1063ASM_PFX(GasketPosixFileSetInfo):
1064 pushq %rbp // stack frame is for the debugger
1065 movq %rsp, %rbp
1066
1067 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1068 pushq %rdi
1069
1070 movq %rcx, %rdi // Swizzle args
1071 movq %rdx, %rsi
1072 movq %r8, %rdx
1073 movq %r9, %rcx
1074
1075 call ASM_PFX(PosixFileSetInfo)
1076
1077 popq %rdi // restore state
1078 popq %rsi
1079 popq %rbp
1080 ret
1081
1082
1083ASM_GLOBAL ASM_PFX(GasketPosixFileFlush)
1084ASM_PFX(GasketPosixFileFlush):
1085 pushq %rbp // stack frame is for the debugger
1086 movq %rsp, %rbp
1087
1088 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1089 pushq %rdi
1090
1091 movq %rcx, %rdi // Swizzle args
1092
1093 call ASM_PFX(PosixFileFlush)
1094
1095 popq %rdi // restore state
1096 popq %rsi
1097 popq %rbp
1098 ret
1099
1100
1101ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkOpen)
1102ASM_PFX(GasketPosixFileSystmeThunkOpen):
1103 pushq %rbp // stack frame is for the debugger
1104 movq %rsp, %rbp
1105
1106 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1107 pushq %rdi
1108
1109 movq %rcx, %rdi // Swizzle args
1110
1111 call ASM_PFX(PosixFileSystmeThunkOpen)
1112
1113 popq %rdi // restore state
1114 popq %rsi
1115 popq %rbp
1116 ret
1117
1118
1119ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkClose)
1120ASM_PFX(GasketPosixFileSystmeThunkClose):
1121 pushq %rbp // stack frame is for the debugger
1122 movq %rsp, %rbp
1123
1124 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1125 pushq %rdi
1126
1127 movq %rcx, %rdi // Swizzle args
1128
1129 call ASM_PFX(PosixFileSystmeThunkClose)
1130
1131 popq %rdi // restore state
1132 popq %rsi
1133 popq %rbp
1134 ret
1135
033d0e5f 1136ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReset)
1137ASM_PFX(GasketEmuBlockIoReset):
1138 pushq %rbp // stack frame is for the debugger
1139 movq %rsp, %rbp
1140
1141 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1142 pushq %rdi
1143
1144 movq %rcx, %rdi // Swizzle args
1145 movq %rdx, %rsi
1146
1147 call ASM_PFX(EmuBlockIoReset)
1148
1149 popq %rdi // restore state
1150 popq %rsi
1151 popq %rbp
1152 ret
1153
1154
1155ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReadBlocks)
1156ASM_PFX(GasketEmuBlockIoReadBlocks):
1157 pushq %rbp // stack frame is for the debugger
1158 movq %rsp, %rbp
1159
1160 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1161 pushq %rdi
1162
1163 movq %rcx, %rdi // Swizzle args
1164 movq %rdx, %rsi
1165 movq %r8, %rdx
1166 movq %r9, %rcx
2b59fcd5 1167 movq 48(%rbp), %r8
1168 movq 56(%rbp), %r9
033d0e5f 1169
1170 call ASM_PFX(EmuBlockIoReadBlocks)
1171
1172 popq %rdi // restore state
1173 popq %rsi
1174 popq %rbp
1175 ret
1176
1177
1178ASM_GLOBAL ASM_PFX(GasketEmuBlockIoWriteBlocks)
1179ASM_PFX(GasketEmuBlockIoWriteBlocks):
1180 pushq %rbp // stack frame is for the debugger
1181 movq %rsp, %rbp
1182
1183 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1184 pushq %rdi
1185
1186 movq %rcx, %rdi // Swizzle args
1187 movq %rdx, %rsi
1188 movq %r8, %rdx
1189 movq %r9, %rcx
2b59fcd5 1190 movq 48(%rbp), %r8
1191 movq 56(%rbp), %r9
033d0e5f 1192
1193 call ASM_PFX(EmuBlockIoWriteBlocks)
1194
1195 popq %rdi // restore state
1196 popq %rsi
1197 popq %rbp
1198 ret
1199
1200
1201ASM_GLOBAL ASM_PFX(GasketEmuBlockIoFlushBlocks)
1202ASM_PFX(GasketEmuBlockIoFlushBlocks):
1203 pushq %rbp // stack frame is for the debugger
1204 movq %rsp, %rbp
1205
1206 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1207 pushq %rdi
1208
1209 movq %rcx, %rdi // Swizzle args
1210 movq %rdx, %rsi
1211
1212 call ASM_PFX(EmuBlockIoFlushBlocks)
1213
1214 popq %rdi // restore state
1215 popq %rsi
1216 popq %rbp
1217 ret
1218
1219
1220ASM_GLOBAL ASM_PFX(GasketEmuBlockIoCreateMapping)
1221ASM_PFX(GasketEmuBlockIoCreateMapping):
1222 pushq %rbp // stack frame is for the debugger
1223 movq %rsp, %rbp
1224
1225 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1226 pushq %rdi
1227
1228 movq %rcx, %rdi // Swizzle args
1229 movq %rdx, %rsi
1230
1231 call ASM_PFX(EmuBlockIoCreateMapping)
1232
1233 popq %rdi // restore state
1234 popq %rsi
1235 popq %rbp
1236 ret
949f388f 1237
1238
033d0e5f 1239ASM_GLOBAL ASM_PFX(GasketBlockIoThunkOpen)
1240ASM_PFX(GasketBlockIoThunkOpen):
1241 pushq %rbp // stack frame is for the debugger
1242 movq %rsp, %rbp
1243
1244 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1245 pushq %rdi
1246
1247 movq %rcx, %rdi // Swizzle args
1248
1249 call ASM_PFX(EmuBlockIoThunkOpen)
1250
1251 popq %rdi // restore state
1252 popq %rsi
1253 popq %rbp
1254 ret
1255
949f388f 1256
033d0e5f 1257ASM_GLOBAL ASM_PFX(GasketBlockIoThunkClose)
1258ASM_PFX(GasketBlockIoThunkClose):
1259 pushq %rbp // stack frame is for the debugger
1260 movq %rsp, %rbp
1261
1262 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1263 pushq %rdi
1264
1265 movq %rcx, %rdi // Swizzle args
1266
1267 call ASM_PFX(EmuBlockIoThunkClose)
1268
1269 popq %rdi // restore state
1270 popq %rsi
1271 popq %rbp
1272 ret
949f388f 1273
1274
1275
2b59fcd5 1276ASM_GLOBAL ASM_PFX(GasketSnpCreateMapping)
1277ASM_PFX(GasketSnpCreateMapping):
1278 pushq %rbp // stack frame is for the debugger
1279 movq %rsp, %rbp
1280
1281 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1282 pushq %rdi
1283
1284 movq %rcx, %rdi // Swizzle args
1285 movq %rdx, %rsi
1286
1287 call ASM_PFX(EmuSnpCreateMapping)
1288
1289 popq %rdi // restore state
1290 popq %rsi
1291 popq %rbp
1292 ret
1293
1294
1295ASM_GLOBAL ASM_PFX(GasketSnpStart)
1296ASM_PFX(GasketSnpStart):
1297 pushq %rbp // stack frame is for the debugger
1298 movq %rsp, %rbp
1299
1300 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1301 pushq %rdi
1302
1303 movq %rcx, %rdi // Swizzle args
1304
1305 call ASM_PFX(EmuSnpStart)
1306
1307 popq %rdi // restore state
1308 popq %rsi
1309 popq %rbp
1310 ret
1311
1312
1313ASM_GLOBAL ASM_PFX(GasketSnpStop)
1314ASM_PFX(GasketSnpStop):
1315 pushq %rbp // stack frame is for the debugger
1316 movq %rsp, %rbp
1317
1318 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1319 pushq %rdi
1320
1321 movq %rcx, %rdi // Swizzle args
1322
1323 call ASM_PFX(EmuSnpStop)
1324
1325 popq %rdi // restore state
1326 popq %rsi
1327 popq %rbp
1328 ret
1329
1330
1331ASM_GLOBAL ASM_PFX(GasketSnpInitialize)
1332ASM_PFX(GasketSnpInitialize):
1333 pushq %rbp // stack frame is for the debugger
1334 movq %rsp, %rbp
1335
1336 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1337 pushq %rdi
1338
1339 movq %rcx, %rdi // Swizzle args
1340 movq %rdx, %rsi
1341 movq %r8, %rdx
1342
1343 call ASM_PFX(EmuSnpInitialize)
1344
1345 popq %rdi // restore state
1346 popq %rsi
1347 popq %rbp
1348 ret
1349
1350
1351
1352ASM_GLOBAL ASM_PFX(GasketSnpReset)
1353ASM_PFX(GasketSnpReset):
1354 pushq %rbp // stack frame is for the debugger
1355 movq %rsp, %rbp
1356
1357 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1358 pushq %rdi
1359
1360 movq %rcx, %rdi // Swizzle args
1361 movq %rdx, %rsi
1362
1363 call ASM_PFX(EmuSnpReset)
1364
1365 popq %rdi // restore state
1366 popq %rsi
1367 popq %rbp
1368 ret
1369
1370
1371ASM_GLOBAL ASM_PFX(GasketSnpShutdown)
1372ASM_PFX(GasketSnpShutdown):
1373 pushq %rbp // stack frame is for the debugger
1374 movq %rsp, %rbp
1375
1376 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1377 pushq %rdi
1378
1379 movq %rcx, %rdi // Swizzle args
1380
1381 call ASM_PFX(EmuSnpShutdown)
1382
1383 popq %rdi // restore state
1384 popq %rsi
1385 popq %rbp
1386 ret
1387
1388
1389ASM_GLOBAL ASM_PFX(GasketSnpReceiveFilters)
1390ASM_PFX(GasketSnpReceiveFilters):
1391 pushq %rbp // stack frame is for the debugger
1392 movq %rsp, %rbp
1393
1394 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1395 pushq %rdi
1396
1397 movq %rcx, %rdi // Swizzle args
1398 movq %rdx, %rsi
1399 movq %r8, %rdx
1400 movq %r9, %rcx
1401 movq 48(%rbp), %r8
1402 movq 56(%rbp), %r9
1403
1404 call ASM_PFX(EmuSnpReceiveFilters)
1405
1406 popq %rdi // restore state
1407 popq %rsi
1408 popq %rbp
1409 ret
1410
1411
1412ASM_GLOBAL ASM_PFX(GasketSnpStationAddress)
1413ASM_PFX(GasketSnpStationAddress):
1414 pushq %rbp // stack frame is for the debugger
1415 movq %rsp, %rbp
1416
1417 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1418 pushq %rdi
1419
1420 movq %rcx, %rdi // Swizzle args
1421 movq %rdx, %rsi
1422 movq %r8, %rdx
1423
1424 call ASM_PFX(EmuSnpStationAddress)
1425
1426 popq %rdi // restore state
1427 popq %rsi
1428 popq %rbp
1429 ret
1430
1431
1432
1433ASM_GLOBAL ASM_PFX(GasketSnpStatistics)
1434ASM_PFX(GasketSnpStatistics):
1435 pushq %rbp // stack frame is for the debugger
1436 movq %rsp, %rbp
1437
1438 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1439 pushq %rdi
1440
1441 movq %rcx, %rdi // Swizzle args
1442 movq %rdx, %rsi
1443 movq %r8, %rdx
1444 movq %r9, %rcx
1445
1446 call ASM_PFX(EmuSnpStatistics)
1447
1448 popq %rdi // restore state
1449 popq %rsi
1450 popq %rbp
1451 ret
1452
1453
1454ASM_GLOBAL ASM_PFX(GasketSnpMCastIpToMac)
1455ASM_PFX(GasketSnpMCastIpToMac):
1456 pushq %rbp // stack frame is for the debugger
1457 movq %rsp, %rbp
1458
1459 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1460 pushq %rdi
1461
1462 movq %rcx, %rdi // Swizzle args
1463 movq %rdx, %rsi
1464 movq %r8, %rdx
1465 movq %r9, %rcx
1466
1467 call ASM_PFX(EmuSnpMCastIpToMac)
1468
1469 popq %rdi // restore state
1470 popq %rsi
1471 popq %rbp
1472 ret
1473
1474
1475ASM_GLOBAL ASM_PFX(GasketSnpNvData)
1476ASM_PFX(GasketSnpNvData):
1477 pushq %rbp // stack frame is for the debugger
1478 movq %rsp, %rbp
1479
1480 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1481 pushq %rdi
1482
1483 movq %rcx, %rdi // Swizzle args
1484 movq %rdx, %rsi
1485 movq %r8, %rdx
1486 movq %r9, %rcx
1487 movq 48(%rbp), %r8
1488
1489 call ASM_PFX(EmuSnpNvData)
1490
1491 popq %rdi // restore state
1492 popq %rsi
1493 popq %rbp
1494 ret
1495
1496
1497ASM_GLOBAL ASM_PFX(GasketSnpGetStatus)
1498ASM_PFX(GasketSnpGetStatus):
1499 pushq %rbp // stack frame is for the debugger
1500 movq %rsp, %rbp
1501
1502 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1503 pushq %rdi
1504
1505 movq %rcx, %rdi // Swizzle args
1506 movq %rdx, %rsi
1507 movq %r8, %rdx
1508
1509 call ASM_PFX(EmuSnpGetStatus)
1510
1511 popq %rdi // restore state
1512 popq %rsi
1513 popq %rbp
1514 ret
1515
1516
1517
1518ASM_GLOBAL ASM_PFX(GasketSnpTransmit)
1519ASM_PFX(GasketSnpTransmit):
1520 pushq %rbp // stack frame is for the debugger
1521 movq %rsp, %rbp
1522 subq $16, %rsp // Allocate space for args on the stack
1523
1524 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1525 pushq %rdi
1526
1527 movq %rcx, %rdi // Swizzle args
1528 movq %rdx, %rsi
1529 movq %r8, %rdx
1530 movq %r9, %rcx
1531 movq 48(%rbp), %r8
1532 movq 56(%rbp), %r9
1533 movq 64(%rbp), %rax
1534 movq %rax, (%rsp)
1535
1536 call ASM_PFX(EmuSnpTransmit)
1537 addq $16, %rsp
1538
1539 popq %rdi // restore state
1540 popq %rsi
1541 popq %rbp
1542 ret
1543
1544
1545
1546ASM_GLOBAL ASM_PFX(GasketSnpReceive)
1547ASM_PFX(GasketSnpReceive):
1548 pushq %rbp // stack frame is for the debugger
1549 movq %rsp, %rbp
1550 subq $16, %rsp // Allocate space for args on the stack
1551
1552 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1553 pushq %rdi
1554
1555 movq %rcx, %rdi // Swizzle args
1556 movq %rdx, %rsi
1557 movq %r8, %rdx
1558 movq %r9, %rcx
1559 movq 48(%rbp), %r8
1560 movq 56(%rbp), %r9
1561 movq 64(%rbp), %rax
1562 movq %rax, (%rsp)
1563
1564 call ASM_PFX(EmuSnpReceive)
1565 addq $16, %rsp
1566
1567 popq %rdi // restore state
1568 popq %rsi
1569 popq %rbp
1570 ret
1571
1572
1573ASM_GLOBAL ASM_PFX(GasketSnpThunkOpen)
1574ASM_PFX(GasketSnpThunkOpen):
1575 pushq %rbp // stack frame is for the debugger
1576 movq %rsp, %rbp
1577
1578 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1579 pushq %rdi
1580
1581 movq %rcx, %rdi // Swizzle args
1582
1583 call ASM_PFX(EmuSnpThunkOpen)
1584
1585 popq %rdi // restore state
1586 popq %rsi
1587 popq %rbp
1588 ret
1589
1590
1591ASM_GLOBAL ASM_PFX(GasketSnpThunkClose)
1592ASM_PFX(GasketSnpThunkClose):
1593 pushq %rbp // stack frame is for the debugger
1594 movq %rsp, %rbp
1595
1596 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1597 pushq %rdi
1598
1599 movq %rcx, %rdi // Swizzle args
1600
1601 call ASM_PFX(EmuSnpThunkClose)
1602
1603 popq %rdi // restore state
1604 popq %rsi
1605 popq %rbp
1606 ret
1607
1608