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