]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/Sec/X64/MangleGasket.S
Fix issue with fixing tabs.
[mirror_edk2.git] / UnixPkg / Sec / X64 / MangleGasket.S
1 #------------------------------------------------------------------------------
2 #
3 # This template was generated from GasketEfiTemplate.c Unix x86_64 ABI
4 #
5 # The EFI_UNIX_THUNK_PROTOCOL member functions call these these generic assembly
6 # routines.
7 #
8 # Some OS X POSIX calls get name mangled in C code and we need to fill in a C global
9 # to get the correct binding (does not work from assembly). So we have 4 functions
10 # that do an indirect call, while the others call POSIX APIs directly
11 #
12 # movq _gUnixRmDir@GOTPCREL(%rip), %rax
13 #
14 #
15 # UNIX Arg passing: RCX, RDX, R8, R9
16 # EFI Arg passing: RDI, RSI, RDX, RCX, R8, R9
17 # Callee allocates 32 bytes on stack to spill registers
18 # RSI, RDI calle-save on EFI, scatch on UNIX callign
19 #
20 #
21 # Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
22 # This program and the accompanying materials
23 # are licensed and made available under the terms and conditions of the BSD License
24 # which accompanies this distribution. The full text of the license may be found at
25 # http://opensource.org/licenses/bsd-license.php
26 #
27 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
28 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
29 #
30 #------------------------------------------------------------------------------
31
32 //
33 // Gaskets are EFI ABI to UNIX ABI calls
34 // EFI ABI code will sub 40 (0x28) from %rsp before calling a function
35 // This is the 32 (0x20) byte to spill registers and 8 bytes to align stack on 16 byte boundry.
36 //
37 .text
38
39 // 32 byte shadow to spill rcx-r9, 8 bytes to align stack on 16 byte boundry
40 // Any call with 0 - 4 arguments allocates 40 bytes on the stack.
41 // For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56,
42 // 7 or 8 args is 72, and 9 or 10 args is 88
43 #define EFI_STACK_SHADOW_SPACE 40
44 #define EFI_STACK_SHADOW_SPACE_5_6 56
45 #define EFI_STACK_SHADOW_SPACE_7_8 72
46 #define EFI_STACK_SHADOW_SPACE_9_10 88
47
48
49
50 .text
51
52
53 ASM_GLOBAL ASM_PFX(Gasketrmdir)
54 ASM_PFX(Gasketrmdir):
55 pushq %rbp // stack frame is for the debugger
56 movq %rsp, %rbp
57
58 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
59 pushq %rdi
60
61 movq %rcx, %rdi // Swizzle args
62
63 movq ASM_PFX(gUnixRmDir)@GOTPCREL(%rip), %rax // Get function name mangled by C
64 movq (%rax), %rax
65 call *%rax
66
67
68 popq %rdi // restore state
69 popq %rsi
70 popq %rbp
71 ret
72
73
74 ASM_GLOBAL ASM_PFX(Gasketopendir)
75 ASM_PFX(Gasketopendir):
76 pushq %rbp // stack frame is for the debugger
77 movq %rsp, %rbp
78
79 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
80 pushq %rdi
81
82 movq %rcx, %rdi // Swizzle args
83
84 movq ASM_PFX(gUnixOpenDir)@GOTPCREL(%rip), %rax // Get function name mangled by C
85 movq (%rax), %rax
86 call *%rax
87
88 popq %rdi // restore state
89 popq %rsi
90 popq %rbp
91 ret
92
93
94
95 ASM_GLOBAL ASM_PFX(Gasketstat)
96 ASM_PFX(Gasketstat):
97 pushq %rbp // stack frame is for the debugger
98 movq %rsp, %rbp
99
100 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
101 pushq %rdi
102
103 movq %rcx, %rdi // Swizzle args
104 movq %rdx, %rsi
105
106 movq ASM_PFX(gUnixStat)@GOTPCREL(%rip), %rax // Get function name mangled by C
107 movq (%rax), %rax
108 call *%rax
109
110
111 popq %rdi // restore state
112 popq %rsi
113 popq %rbp
114 ret
115
116
117 ASM_GLOBAL ASM_PFX(Gasketstatfs)
118 ASM_PFX(Gasketstatfs):
119 pushq %rbp // stack frame is for the debugger
120 movq %rsp, %rbp
121
122 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
123 pushq %rdi
124
125 movq %rcx, %rdi // Swizzle args
126 movq %rdx, %rsi
127
128 movq ASM_PFX(gUnixStatFs)@GOTPCREL(%rip), %rax // Get function name mangled by C
129 movq (%rax), %rax
130 call *%rax
131
132 popq %rdi // restore state
133 popq %rsi
134 popq %rbp
135 ret
136
137 ASM_GLOBAL ASM_PFX(Gasketrewinddir)
138 ASM_PFX(Gasketrewinddir):
139 pushq %rbp // stack frame is for the debugger
140 movq %rsp, %rbp
141
142 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
143 pushq %rdi
144
145 movq %rcx, %rdi // Swizzle args
146
147 movq ASM_PFX(gUnixRewinddir)@GOTPCREL(%rip), %rax // Get function name mangled by C
148 movq (%rax), %rax
149 call *%rax
150
151 popq %rdi // restore state
152 popq %rsi
153 popq %rbp
154 ret
155
156 ASM_GLOBAL ASM_PFX(Gasketreaddir)
157 ASM_PFX(Gasketreaddir):
158 pushq %rbp // stack frame is for the debugger
159 movq %rsp, %rbp
160
161 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
162 pushq %rdi
163
164 movq %rcx, %rdi // Swizzle args
165
166 movq ASM_PFX(gUnixReaddir)@GOTPCREL(%rip), %rax // Get function name mangled by C
167 movq (%rax), %rax
168 call *%rax
169
170 popq %rdi // restore state
171 popq %rsi
172 popq %rbp
173 ret
174
175
176 ASM_GLOBAL ASM_PFX(GasketmsSleep)
177 ASM_PFX(GasketmsSleep):
178 pushq %rbp // stack frame is for the debugger
179 movq %rsp, %rbp
180
181 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
182 pushq %rdi
183
184 movq %rcx, %rdi // Swizzle args
185
186 call ASM_PFX(msSleep)
187
188 popq %rdi // restore state
189 popq %rsi
190 popq %rbp
191 ret
192
193
194 ASM_GLOBAL ASM_PFX(Gasketexit)
195 ASM_PFX(Gasketexit):
196 movq %rcx, %rdi // Swizzle args
197 call ASM_PFX(exit) // Less to do as we will never return to EFI ABI world
198 LDEAD_LOOP:
199 jmp LDEAD_LOOP // _exit should never return
200
201
202
203 ASM_GLOBAL ASM_PFX(GasketSetTimer)
204 ASM_PFX(GasketSetTimer):
205 pushq %rbp // stack frame is for the debugger
206 movq %rsp, %rbp
207
208 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
209 pushq %rdi
210
211 movq %rcx, %rdi // Swizzle args
212 movq %rdx, %rsi
213
214 call ASM_PFX(SetTimer)
215
216 popq %rdi // restore state
217 popq %rsi
218 popq %rbp
219 ret
220
221
222 ASM_GLOBAL ASM_PFX(GasketGetLocalTime)
223 ASM_PFX(GasketGetLocalTime):
224 pushq %rbp // stack frame is for the debugger
225 movq %rsp, %rbp
226
227 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
228 pushq %rdi
229
230 movq %rcx, %rdi // Swizzle args
231
232 call ASM_PFX(GetLocalTime)
233
234 popq %rdi // restore state
235 popq %rsi
236 popq %rbp
237 ret
238
239
240
241 ASM_GLOBAL ASM_PFX(Gasketgmtime)
242 ASM_PFX(Gasketgmtime):
243 pushq %rbp // stack frame is for the debugger
244 movq %rsp, %rbp
245
246 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
247 pushq %rdi
248
249 movq %rcx, %rdi // Swizzle args
250
251 call ASM_PFX(localtime)
252
253 popq %rdi // restore state
254 popq %rsi
255 popq %rbp
256 ret
257
258
259
260 ASM_GLOBAL ASM_PFX(GasketGetTimeZone)
261 ASM_PFX(GasketGetTimeZone):
262 pushq %rbp // stack frame is for the debugger
263 movq %rsp, %rbp
264
265 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
266 pushq %rdi
267
268 call ASM_PFX(GetTimeZone)
269
270 popq %rdi // restore state
271 popq %rsi
272 popq %rbp
273 ret
274
275
276 ASM_GLOBAL ASM_PFX(GasketGetDayLight)
277 ASM_PFX(GasketGetDayLight):
278 pushq %rbp // stack frame is for the debugger
279 movq %rsp, %rbp
280
281 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
282 pushq %rdi
283
284 call ASM_PFX(GetDayLight)
285
286 popq %rdi // restore state
287 popq %rsi
288 popq %rbp
289 ret
290
291
292 ASM_GLOBAL ASM_PFX(Gasketpoll)
293 ASM_PFX(Gasketpoll):
294 pushq %rbp // stack frame is for the debugger
295 movq %rsp, %rbp
296
297 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
298 pushq %rdi
299
300 movq %rcx, %rdi // Swizzle args
301 movq %rdx, %rsi
302 movq %r8, %rdx
303
304 call ASM_PFX(poll)
305
306 popq %rdi // restore state
307 popq %rsi
308 popq %rbp
309 ret
310
311
312
313 ASM_GLOBAL ASM_PFX(Gasketread)
314 ASM_PFX(Gasketread):
315 pushq %rbp // stack frame is for the debugger
316 movq %rsp, %rbp
317
318 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
319 pushq %rdi
320
321 movq %rcx, %rdi // Swizzle args
322 movq %rdx, %rsi
323 movq %r8, %rdx
324
325 call ASM_PFX(read)
326
327 popq %rdi // restore state
328 popq %rsi
329 popq %rbp
330 ret
331
332
333 ASM_GLOBAL ASM_PFX(Gasketwrite)
334 ASM_PFX(Gasketwrite):
335 pushq %rbp // stack frame is for the debugger
336 movq %rsp, %rbp
337
338 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
339 pushq %rdi
340
341 movq %rcx, %rdi // Swizzle args
342 movq %rdx, %rsi
343 movq %r8, %rdx
344
345 call ASM_PFX(write)
346
347 popq %rdi // restore state
348 popq %rsi
349 popq %rbp
350 ret
351
352
353 ASM_GLOBAL ASM_PFX(Gasketgetenv)
354 ASM_PFX(Gasketgetenv):
355 pushq %rbp // stack frame is for the debugger
356 movq %rsp, %rbp
357
358 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
359 pushq %rdi
360
361 movq %rcx, %rdi // Swizzle args
362
363 call ASM_PFX(getenv)
364
365 popq %rdi // restore state
366 popq %rsi
367 popq %rbp
368 ret
369
370
371 ASM_GLOBAL ASM_PFX(Gasketopen)
372 ASM_PFX(Gasketopen):
373 pushq %rbp // stack frame is for the debugger
374 movq %rsp, %rbp
375
376 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
377 pushq %rdi
378
379 movq %rcx, %rdi // Swizzle args
380 movq %rdx, %rsi
381 movq %r8, %rdx
382
383 call ASM_PFX(open)
384
385 popq %rdi // restore state
386 popq %rsi
387 popq %rbp
388 ret
389
390
391 ASM_GLOBAL ASM_PFX(Gasketlseek)
392 ASM_PFX(Gasketlseek):
393 pushq %rbp // stack frame is for the debugger
394 movq %rsp, %rbp
395
396 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
397 pushq %rdi
398
399 movq %rcx, %rdi // Swizzle args
400 movq %rdx, %rsi
401 movq %r8, %rdx
402
403 call ASM_PFX(lseek)
404
405 popq %rdi // restore state
406 popq %rsi
407 popq %rbp
408 ret
409
410
411 ASM_GLOBAL ASM_PFX(Gasketftruncate)
412 ASM_PFX(Gasketftruncate):
413 pushq %rbp // stack frame is for the debugger
414 movq %rsp, %rbp
415
416 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
417 pushq %rdi
418
419 movq %rcx, %rdi // Swizzle args
420 movq %rdx, %rsi
421 movq %r8, %rdx
422
423 call ASM_PFX(ftruncate)
424
425 popq %rdi // restore state
426 popq %rsi
427 popq %rbp
428 ret
429
430
431 ASM_GLOBAL ASM_PFX(Gasketclose)
432 ASM_PFX(Gasketclose):
433 pushq %rbp // stack frame is for the debugger
434 movq %rsp, %rbp
435
436 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
437 pushq %rdi
438
439 movq %rcx, %rdi // Swizzle args
440
441 call ASM_PFX(close)
442
443 popq %rdi // restore state
444 popq %rsi
445 popq %rbp
446 ret
447
448
449
450 ASM_GLOBAL ASM_PFX(Gasketmkdir)
451 ASM_PFX(Gasketmkdir):
452 pushq %rbp // stack frame is for the debugger
453 movq %rsp, %rbp
454
455 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
456 pushq %rdi
457
458 movq %rcx, %rdi // Swizzle args
459 movq %rdx, %rsi
460
461 call ASM_PFX(mkdir)
462
463 popq %rdi // restore state
464 popq %rsi
465 popq %rbp
466 ret
467
468
469 ASM_GLOBAL ASM_PFX(Gasketunlink)
470 ASM_PFX(Gasketunlink):
471 pushq %rbp // stack frame is for the debugger
472 movq %rsp, %rbp
473
474 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
475 pushq %rdi
476
477 movq %rcx, %rdi // Swizzle args
478
479 call ASM_PFX(unlink)
480
481 popq %rdi // restore state
482 popq %rsi
483 popq %rbp
484 ret
485
486
487 ASM_GLOBAL ASM_PFX(GasketGetErrno)
488 ASM_PFX(GasketGetErrno):
489 pushq %rbp // stack frame is for the debugger
490 movq %rsp, %rbp
491
492 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
493 pushq %rdi
494
495 call ASM_PFX(GetErrno)
496
497 popq %rdi // restore state
498 popq %rsi
499 popq %rbp
500 ret
501
502 ASM_GLOBAL ASM_PFX(Gasketclosedir)
503 ASM_PFX(Gasketclosedir):
504 pushq %rbp // stack frame is for the debugger
505 movq %rsp, %rbp
506
507 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
508 pushq %rdi
509
510 movq %rcx, %rdi // Swizzle args
511
512 call ASM_PFX(closedir)
513
514 popq %rdi // restore state
515 popq %rsi
516 popq %rbp
517 ret
518
519
520 ASM_GLOBAL ASM_PFX(Gasketrename)
521 ASM_PFX(Gasketrename):
522 pushq %rbp // stack frame is for the debugger
523 movq %rsp, %rbp
524
525 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
526 pushq %rdi
527
528 movq %rcx, %rdi // Swizzle args
529 movq %rdx, %rsi
530
531 call ASM_PFX(rename)
532
533 popq %rdi // restore state
534 popq %rsi
535 popq %rbp
536 ret
537
538
539 ASM_GLOBAL ASM_PFX(Gasketmktime)
540 ASM_PFX(Gasketmktime):
541 pushq %rbp // stack frame is for the debugger
542 movq %rsp, %rbp
543
544 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
545 pushq %rdi
546
547 movq %rcx, %rdi // Swizzle args
548 movq %rdx, %rsi
549
550 call ASM_PFX(mktime)
551
552 popq %rdi // restore state
553 popq %rsi
554 popq %rbp
555 ret
556
557
558 ASM_GLOBAL ASM_PFX(Gasketfsync)
559 ASM_PFX(Gasketfsync):
560 pushq %rbp // stack frame is for the debugger
561 movq %rsp, %rbp
562
563 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
564 pushq %rdi
565
566 movq %rcx, %rdi // Swizzle args
567 movq %rdx, %rsi
568
569 call ASM_PFX(fsync)
570
571 popq %rdi // restore state
572 popq %rsi
573 popq %rbp
574 ret
575
576
577 ASM_GLOBAL ASM_PFX(Gasketchmod)
578 ASM_PFX(Gasketchmod):
579 pushq %rbp // stack frame is for the debugger
580 movq %rsp, %rbp
581
582 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
583 pushq %rdi
584
585 movq %rcx, %rdi // Swizzle args
586 movq %rdx, %rsi
587
588 call ASM_PFX(chmod)
589
590 popq %rdi // restore state
591 popq %rsi
592 popq %rbp
593 ret
594
595
596 ASM_GLOBAL ASM_PFX(Gasketutime)
597 ASM_PFX(Gasketutime):
598 pushq %rbp // stack frame is for the debugger
599 movq %rsp, %rbp
600
601 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
602 pushq %rdi
603
604 movq %rcx, %rdi // Swizzle args
605 movq %rdx, %rsi
606
607 call ASM_PFX(utime)
608
609 popq %rdi // restore state
610 popq %rsi
611 popq %rbp
612 ret
613
614
615 ASM_GLOBAL ASM_PFX(Gaskettcflush)
616 ASM_PFX(Gaskettcflush):
617 pushq %rbp // stack frame is for the debugger
618 movq %rsp, %rbp
619
620 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
621 pushq %rdi
622
623 movq %rcx, %rdi // Swizzle args
624 movq %rdx, %rsi
625
626 call ASM_PFX(tcflush)
627
628 popq %rdi // restore state
629 popq %rsi
630 popq %rbp
631 ret
632
633
634 ASM_GLOBAL ASM_PFX(GasketUgaCreate)
635 ASM_PFX(GasketUgaCreate):
636 pushq %rbp // stack frame is for the debugger
637 movq %rsp, %rbp
638
639 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
640 pushq %rdi
641
642 movq %rcx, %rdi // Swizzle args
643 movq %rdx, %rsi
644
645 call ASM_PFX(UgaCreate)
646
647 popq %rdi // restore state
648 popq %rsi
649 popq %rbp
650 ret
651
652
653 ASM_GLOBAL ASM_PFX(Gasketperror)
654 ASM_PFX(Gasketperror):
655 pushq %rbp // stack frame is for the debugger
656 movq %rsp, %rbp
657
658 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
659 pushq %rdi
660
661 movq %rcx, %rdi // Swizzle args
662 movq %rdx, %rsi
663
664 call ASM_PFX(perror)
665
666 popq %rdi // restore state
667 popq %rsi
668 popq %rbp
669 ret
670
671
672 ASM_GLOBAL ASM_PFX(Gasketioctl)
673 ASM_PFX(Gasketioctl):
674 pushq %rbp // stack frame is for the debugger
675 movq %rsp, %rbp
676
677 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
678 pushq %rdi
679
680 movq %rcx, %rdi // Swizzle args
681 movq %rdx, %rsi
682 movq %r8, %rdx
683
684 call ASM_PFX(UnixIoCtl1)
685
686 popq %rdi // restore state
687 popq %rsi
688 popq %rbp
689 ret
690
691
692 ASM_GLOBAL ASM_PFX(Gasketfcntl)
693 ASM_PFX(Gasketfcntl):
694 pushq %rbp // stack frame is for the debugger
695 movq %rsp, %rbp
696
697 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
698 pushq %rdi
699
700 movq %rcx, %rdi // Swizzle args
701 movq %rdx, %rsi
702 movq %r8, %rdx
703
704 call ASM_PFX(UnixFcntl1)
705
706 popq %rdi // restore state
707 popq %rsi
708 popq %rbp
709 ret
710
711
712
713 ASM_GLOBAL ASM_PFX(Gasketcfsetispeed)
714 ASM_PFX(Gasketcfsetispeed):
715 pushq %rbp // stack frame is for the debugger
716 movq %rsp, %rbp
717
718 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
719 pushq %rdi
720
721 movq %rcx, %rdi // Swizzle args
722 movq %rdx, %rsi
723
724 call ASM_PFX(cfsetispeed)
725
726 popq %rdi // restore state
727 popq %rsi
728 popq %rbp
729 ret
730
731
732
733 ASM_GLOBAL ASM_PFX(Gasketcfsetospeed)
734 ASM_PFX(Gasketcfsetospeed):
735 pushq %rbp // stack frame is for the debugger
736 movq %rsp, %rbp
737
738 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
739 pushq %rdi
740
741 movq %rcx, %rdi // Swizzle args
742 movq %rdx, %rsi
743
744 call ASM_PFX(cfsetospeed)
745
746 popq %rdi // restore state
747 popq %rsi
748 popq %rbp
749 ret
750
751
752 ASM_GLOBAL ASM_PFX(Gaskettcgetattr)
753 ASM_PFX(Gaskettcgetattr):
754 pushq %rbp // stack frame is for the debugger
755 movq %rsp, %rbp
756
757 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
758 pushq %rdi
759
760 movq %rcx, %rdi // Swizzle args
761 movq %rdx, %rsi
762 movq %r8, %rdx
763
764 call ASM_PFX(tcgetattr)
765
766 popq %rdi // restore state
767 popq %rsi
768 popq %rbp
769 ret
770
771
772 ASM_GLOBAL ASM_PFX(Gaskettcsetattr)
773 ASM_PFX(Gaskettcsetattr):
774 pushq %rbp // stack frame is for the debugger
775 movq %rsp, %rbp
776
777 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
778 pushq %rdi
779
780 movq %rcx, %rdi // Swizzle args
781 movq %rdx, %rsi
782 movq %r8, %rdx
783
784 call ASM_PFX(tcsetattr)
785
786 popq %rdi // restore state
787 popq %rsi
788 popq %rbp
789 ret
790
791
792 ASM_GLOBAL ASM_PFX(GasketUnixPeCoffGetEntryPoint)
793 ASM_PFX(GasketUnixPeCoffGetEntryPoint):
794 pushq %rbp // stack frame is for the debugger
795 movq %rsp, %rbp
796
797 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
798 pushq %rdi
799
800 movq %rcx, %rdi // Swizzle args
801 movq %rdx, %rsi
802
803 call ASM_PFX(SecPeCoffGetEntryPoint)
804
805 popq %rdi // restore state
806 popq %rsi
807 popq %rbp
808 ret
809
810
811
812 ASM_GLOBAL ASM_PFX(GasketUnixPeCoffRelocateImageExtraAction)
813 ASM_PFX(GasketUnixPeCoffRelocateImageExtraAction):
814 pushq %rbp // stack frame is for the debugger
815 movq %rsp, %rbp
816
817 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
818 pushq %rdi
819
820 movq %rcx, %rdi // Swizzle args
821
822 call ASM_PFX(SecPeCoffRelocateImageExtraAction)
823
824 popq %rdi // restore state
825 popq %rsi
826 popq %rbp
827 ret
828
829
830 ASM_GLOBAL ASM_PFX(GasketUnixPeCoffUnloadImageExtraAction)
831 ASM_PFX(GasketUnixPeCoffUnloadImageExtraAction):
832 pushq %rbp // stack frame is for the debugger
833 movq %rsp, %rbp
834
835 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
836 pushq %rdi
837
838 movq %rcx, %rdi // Swizzle args
839
840 call ASM_PFX(SecPeCoffLoaderUnloadImageExtraAction)
841
842 popq %rdi // restore state
843 popq %rsi
844 popq %rbp
845 ret
846
847
848
849
850
851 ASM_GLOBAL ASM_PFX(Gasketsocket)
852 ASM_PFX(Gasketsocket):
853 pushq %rbp // stack frame is for the debugger
854 movq %rsp, %rbp
855
856 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
857 pushq %rdi
858
859 movq %rcx, %rdi // Swizzle args
860 movq %rdx, %rsi
861 movq %r8, %rdx
862
863 call ASM_PFX(socket)
864
865
866 popq %rdi // restore state
867 popq %rsi
868 popq %rbp
869 ret
870
871
872
873 ASM_GLOBAL ASM_PFX(Gasketgetifaddrs)
874 ASM_PFX(Gasketgetifaddrs):
875 pushq %rbp // stack frame is for the debugger
876 movq %rsp, %rbp
877
878 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
879 pushq %rdi
880
881 movq %rcx, %rdi // Swizzle args
882
883 call ASM_PFX(getifaddrs)
884
885
886 popq %rbp
887 popq %rsi
888 popq %rbp
889 ret
890
891
892
893 ASM_GLOBAL _Gasketfreeifaddrs
894 _Gasketfreeifaddrs:
895 pushq %rbp // stack frame is for the debugger
896 movq %rsp, %rbp
897
898 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
899 pushq %rdi
900
901 movq %rcx, %rdi // Swizzle args
902
903 call _freeifaddrs
904
905
906 popq %rdi // restore state
907 popq %rsi
908 popq %rbp
909 ret
910
911
912
913
914
915 ASM_GLOBAL ASM_PFX(GasketUgaClose)
916 ASM_PFX(GasketUgaClose):
917 pushq %rbp // stack frame is for the debugger
918 movq %rsp, %rbp
919
920 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
921 pushq %rdi
922
923 movq %rcx, %rdi // Swizzle args
924
925 call ASM_PFX(UgaClose)
926
927 popq %rdi // restore state
928 popq %rsi
929 popq %rbp
930 ret
931
932
933
934
935 ASM_GLOBAL ASM_PFX(GasketUgaSize)
936 ASM_PFX(GasketUgaSize):
937 pushq %rbp // stack frame is for the debugger
938 movq %rsp, %rbp
939
940 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
941 pushq %rdi
942
943 movq %rcx, %rdi // Swizzle args
944 movq %rdx, %rsi
945 movq %r8, %rdx
946
947 call ASM_PFX(UgaSize)
948
949 popq %rdi // restore state
950 popq %rsi
951 popq %rbp
952 ret
953
954
955 ASM_GLOBAL ASM_PFX(GasketUgaCheckKey)
956 ASM_PFX(GasketUgaCheckKey):
957 pushq %rbp // stack frame is for the debugger
958 movq %rsp, %rbp
959
960 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
961 pushq %rdi
962
963 movq %rcx, %rdi // Swizzle args
964
965 call ASM_PFX(UgaCheckKey)
966
967 popq %rdi // restore state
968 popq %rsi
969 popq %rbp
970 ret
971
972
973 ASM_GLOBAL ASM_PFX(GasketUgaGetKey)
974 ASM_PFX(GasketUgaGetKey):
975 pushq %rbp // stack frame is for the debugger
976 movq %rsp, %rbp
977
978 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
979 pushq %rdi
980
981 movq %rcx, %rdi // Swizzle args
982 movq %rdx, %rsi
983
984 call ASM_PFX(UgaGetKey)
985
986 popq %rdi // restore state
987 popq %rsi
988 popq %rbp
989 ret
990
991 ASM_GLOBAL ASM_PFX(GasketUgaKeySetState)
992 ASM_PFX(GasketUgaKeySetState):
993 pushq %rbp // stack frame is for the debugger
994 movq %rsp, %rbp
995
996 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
997 pushq %rdi
998
999 movq %rcx, %rdi // Swizzle args
1000 movq %rdx, %rsi
1001
1002 call ASM_PFX(UgaKeySetState)
1003
1004 popq %rdi // restore state
1005 popq %rsi
1006 popq %rbp
1007 ret
1008
1009
1010 ASM_GLOBAL ASM_PFX(GasketUgaRegisterKeyNotify)
1011 ASM_PFX(GasketUgaRegisterKeyNotify):
1012 pushq %rbp // stack frame is for the debugger
1013 movq %rsp, %rbp
1014
1015 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1016 pushq %rdi
1017
1018 movq %rcx, %rdi // Swizzle args
1019 movq %rdx, %rsi
1020 movq %r8, %rdx
1021
1022 call ASM_PFX(UgaRegisterKeyNotify)
1023
1024 popq %rdi // restore state
1025 popq %rsi
1026 popq %rbp
1027 ret
1028
1029
1030
1031
1032
1033 ASM_GLOBAL ASM_PFX(GasketUgaBlt)
1034 ASM_PFX(GasketUgaBlt):
1035 pushq %rbp // stack frame is for the debugger
1036 movq %rsp, %rbp
1037
1038 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1039 pushq %rdi
1040
1041 movq %rcx, %rdi // Swizzle args
1042 movq %rdx, %rsi
1043 movq %r8, %rdx
1044 movq %r9, %rcx
1045
1046 call ASM_PFX(UgaBlt)
1047
1048 popq %rdi // restore state
1049 popq %rsi
1050 popq %rbp
1051 ret
1052
1053
1054 ASM_GLOBAL ASM_PFX(GasketUgaCheckPointer)
1055 ASM_PFX(GasketUgaCheckPointer):
1056 pushq %rbp // stack frame is for the debugger
1057 movq %rsp, %rbp
1058
1059 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1060 pushq %rdi
1061
1062 movq %rcx, %rdi // Swizzle args
1063
1064 call ASM_PFX(UgaCheckPointer)
1065
1066 popq %rdi // restore state
1067 popq %rsi
1068 popq %rbp
1069 ret
1070
1071
1072 ASM_GLOBAL ASM_PFX(GasketUgaGetPointerState)
1073 ASM_PFX(GasketUgaGetPointerState):
1074 pushq %rbp // stack frame is for the debugger
1075 movq %rsp, %rbp
1076
1077 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1078 pushq %rdi
1079
1080 movq %rcx, %rdi // Swizzle args
1081 movq %rdx, %rsi
1082
1083 call ASM_PFX(UgaGetPointerState)
1084
1085 popq %rdi // restore state
1086 popq %rsi
1087 popq %rbp
1088 ret
1089
1090
1091 ASM_GLOBAL ASM_PFX(GasketUnixEnableInterrupt)
1092 ASM_PFX(GasketUnixEnableInterrupt):
1093 pushq %rbp // stack frame is for the debugger
1094 movq %rsp, %rbp
1095
1096 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1097 pushq %rdi
1098
1099 call ASM_PFX(UnixEnableInterrupt)
1100
1101 popq %rdi // restore state
1102 popq %rsi
1103 popq %rbp
1104 ret
1105
1106 ASM_GLOBAL ASM_PFX(GasketUnixDisableInterrupt)
1107 ASM_PFX(GasketUnixDisableInterrupt):
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
1114 call ASM_PFX(UnixDisableInterrupt)
1115
1116 popq %rdi // restore state
1117 popq %rsi
1118 popq %rbp
1119 ret
1120
1121 //
1122 // UNIX ABI to EFI ABI call
1123 //
1124 // UINTN
1125 // ReverseGasketUint64 (
1126 // void *Api,
1127 // UINTN Arg1
1128 // );
1129 ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
1130 ASM_PFX(ReverseGasketUint64):
1131 pushq %rbp // stack frame is for the debugger
1132 movq %rsp, %rbp
1133
1134 movq %rdi, %rax // Swizzle args
1135 movq %rsi, %rcx
1136
1137 subq $32, %rsp // 32-byte shadow space
1138 call *%rax
1139 addq $32, %rsp
1140
1141 popq %rbp
1142 ret
1143
1144 //
1145 // UNIX ABI to EFI ABI call
1146 //
1147 // UINTN
1148 // ReverseGasketUint64Uint64 (
1149 // void *Api,
1150 // UINTN Arg1
1151 // UINTN Arg2
1152 // );
1153 ASM_GLOBAL ASM_PFX(ReverseGasketUint64Uint64)
1154 ASM_PFX(ReverseGasketUint64Uint64):
1155 pushq %rbp // stack frame is for the debugger
1156 movq %rsp, %rbp
1157
1158 movq %rdi, %rax // Swizzle args
1159 movq %rsi, %rcx
1160
1161 subq $32, %rsp // 32-byte shadow space
1162 call *%rax
1163 addq $32, %rsp
1164
1165 popq %rbp
1166 ret
1167
1168
1169 // Sec PPI Callbacks
1170
1171 ASM_GLOBAL ASM_PFX(GasketSecUnixPeiLoadFile)
1172 ASM_PFX(GasketSecUnixPeiLoadFile):
1173 pushq %rbp // stack frame is for the debugger
1174 movq %rsp, %rbp
1175
1176 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1177 pushq %rdi
1178
1179 movq %rcx, %rdi // Swizzle args
1180 movq %rdx, %rsi
1181 movq %r8, %rdx
1182 movq %r9, %rcx
1183
1184 call ASM_PFX(SecUnixPeiLoadFile)
1185
1186 popq %rdi // restore state
1187 popq %rsi
1188 popq %rbp
1189 ret
1190
1191
1192
1193 ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
1194 ASM_PFX(GasketSecUnixPeiAutoScan):
1195 pushq %rbp // stack frame is for the debugger
1196 movq %rsp, %rbp
1197
1198 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1199 pushq %rdi
1200
1201 movq %rcx, %rdi // Swizzle args
1202 movq %rdx, %rsi
1203 movq %r8, %rdx
1204
1205 call ASM_PFX(SecUnixPeiAutoScan)
1206
1207 popq %rdi // restore state
1208 popq %rsi
1209 popq %rbp
1210 ret
1211
1212 ASM_GLOBAL ASM_PFX(GasketSecUnixUnixThunkAddress)
1213 ASM_PFX(GasketSecUnixUnixThunkAddress):
1214 pushq %rbp // stack frame is for the debugger
1215 movq %rsp, %rbp
1216
1217 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1218 pushq %rdi
1219
1220 call ASM_PFX(SecUnixUnixThunkAddress)
1221
1222
1223 popq %rdi
1224 popq %rsi
1225 popq %rbp
1226 ret
1227
1228
1229 ASM_GLOBAL ASM_PFX(GasketSecPeiReportStatusCode)
1230 ASM_PFX(GasketSecPeiReportStatusCode):
1231 pushq %rbp // stack frame is for the debugger
1232 movq %rsp, %rbp
1233
1234 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1235 pushq %rdi
1236
1237 movq %rcx, %rdi // Swizzle args
1238 movq %rdx, %rsi
1239 movq %r8, %rdx
1240 movq %r9, %rcx
1241 movq $0, %r8 // BugBug: This should come from the stack
1242 movq $0, %r9 // But we can cheat since they are optional for bringup....
1243
1244 call ASM_PFX(SecPeiReportStatusCode)
1245
1246 popq %rdi // restore state
1247 popq %rsi
1248 popq %rbp
1249 ret
1250
1251
1252 ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
1253 ASM_PFX(GasketSecUnixFdAddress):
1254 pushq %rbp // stack frame is for the debugger
1255 movq %rsp, %rbp
1256
1257 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1258 pushq %rdi
1259
1260 movq %rcx, %rdi // Swizzle args
1261 movq %rdx, %rsi
1262 movq %r8, %rdx
1263 movq %r9, %rcx
1264
1265 call ASM_PFX(SecUnixFdAddress)
1266
1267 popq %rdi // restore state
1268 popq %rsi
1269 popq %rbp
1270 ret
1271
1272
1273
1274
1275 ASM_GLOBAL ASM_PFX(GasketSecTemporaryRamSupport)
1276 ASM_PFX(GasketSecTemporaryRamSupport):
1277 pushq %rbp // stack frame is for the debugger
1278 movq %rsp, %rbp
1279
1280 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1281 pushq %rdi
1282
1283 movq %rcx, %rdi // Swizzle args
1284 movq %rdx, %rsi
1285 movq %r8, %rdx
1286 movq %r9, %rcx
1287
1288 call ASM_PFX(SecTemporaryRamSupport)
1289
1290 popq %rdi // restore state
1291 popq %rsi
1292 popq %rbp
1293 ret
1294
1295
1296
1297
1298