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