]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/Sec/X64/MangleGasket.S
Update DebugLib to provide support for "err" command in the EFI Shell to adjust the...
[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 ASM_GLOBAL ASM_PFX(Gasketfreeifaddrs)
893 ASM_PFX(Gasketfreeifaddrs):
894 pushq %rbp // stack frame is for the debugger
895 movq %rsp, %rbp
896
897 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
898 pushq %rdi
899
900 movq %rcx, %rdi // Swizzle args
901
902 call ASM_PFX(freeifaddrs)
903
904
905 popq %rdi // restore state
906 popq %rsi
907 popq %rbp
908 ret
909
910
911 ASM_GLOBAL ASM_PFX(GasketUgaClose)
912 ASM_PFX(GasketUgaClose):
913 pushq %rbp // stack frame is for the debugger
914 movq %rsp, %rbp
915
916 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
917 pushq %rdi
918
919 movq %rcx, %rdi // Swizzle args
920
921 call ASM_PFX(UgaClose)
922
923 popq %rdi // restore state
924 popq %rsi
925 popq %rbp
926 ret
927
928
929
930
931 ASM_GLOBAL ASM_PFX(GasketUgaSize)
932 ASM_PFX(GasketUgaSize):
933 pushq %rbp // stack frame is for the debugger
934 movq %rsp, %rbp
935
936 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
937 pushq %rdi
938
939 movq %rcx, %rdi // Swizzle args
940 movq %rdx, %rsi
941 movq %r8, %rdx
942
943 call ASM_PFX(UgaSize)
944
945 popq %rdi // restore state
946 popq %rsi
947 popq %rbp
948 ret
949
950
951 ASM_GLOBAL ASM_PFX(GasketUgaCheckKey)
952 ASM_PFX(GasketUgaCheckKey):
953 pushq %rbp // stack frame is for the debugger
954 movq %rsp, %rbp
955
956 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
957 pushq %rdi
958
959 movq %rcx, %rdi // Swizzle args
960
961 call ASM_PFX(UgaCheckKey)
962
963 popq %rdi // restore state
964 popq %rsi
965 popq %rbp
966 ret
967
968
969 ASM_GLOBAL ASM_PFX(GasketUgaGetKey)
970 ASM_PFX(GasketUgaGetKey):
971 pushq %rbp // stack frame is for the debugger
972 movq %rsp, %rbp
973
974 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
975 pushq %rdi
976
977 movq %rcx, %rdi // Swizzle args
978 movq %rdx, %rsi
979
980 call ASM_PFX(UgaGetKey)
981
982 popq %rdi // restore state
983 popq %rsi
984 popq %rbp
985 ret
986
987 ASM_GLOBAL ASM_PFX(GasketUgaKeySetState)
988 ASM_PFX(GasketUgaKeySetState):
989 pushq %rbp // stack frame is for the debugger
990 movq %rsp, %rbp
991
992 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
993 pushq %rdi
994
995 movq %rcx, %rdi // Swizzle args
996 movq %rdx, %rsi
997
998 call ASM_PFX(UgaKeySetState)
999
1000 popq %rdi // restore state
1001 popq %rsi
1002 popq %rbp
1003 ret
1004
1005
1006 ASM_GLOBAL ASM_PFX(GasketUgaRegisterKeyNotify)
1007 ASM_PFX(GasketUgaRegisterKeyNotify):
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
1014 movq %rcx, %rdi // Swizzle args
1015 movq %rdx, %rsi
1016 movq %r8, %rdx
1017
1018 call ASM_PFX(UgaRegisterKeyNotify)
1019
1020 popq %rdi // restore state
1021 popq %rsi
1022 popq %rbp
1023 ret
1024
1025
1026
1027
1028
1029 ASM_GLOBAL ASM_PFX(GasketUgaBlt)
1030 ASM_PFX(GasketUgaBlt):
1031 pushq %rbp // stack frame is for the debugger
1032 movq %rsp, %rbp
1033
1034 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1035 pushq %rdi
1036
1037 movq %rcx, %rdi // Swizzle args
1038 movq %rdx, %rsi
1039 movq %r8, %rdx
1040 movq %r9, %rcx
1041
1042 call ASM_PFX(UgaBlt)
1043
1044 popq %rdi // restore state
1045 popq %rsi
1046 popq %rbp
1047 ret
1048
1049
1050 ASM_GLOBAL ASM_PFX(GasketUgaCheckPointer)
1051 ASM_PFX(GasketUgaCheckPointer):
1052 pushq %rbp // stack frame is for the debugger
1053 movq %rsp, %rbp
1054
1055 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1056 pushq %rdi
1057
1058 movq %rcx, %rdi // Swizzle args
1059
1060 call ASM_PFX(UgaCheckPointer)
1061
1062 popq %rdi // restore state
1063 popq %rsi
1064 popq %rbp
1065 ret
1066
1067
1068 ASM_GLOBAL ASM_PFX(GasketUgaGetPointerState)
1069 ASM_PFX(GasketUgaGetPointerState):
1070 pushq %rbp // stack frame is for the debugger
1071 movq %rsp, %rbp
1072
1073 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1074 pushq %rdi
1075
1076 movq %rcx, %rdi // Swizzle args
1077 movq %rdx, %rsi
1078
1079 call ASM_PFX(UgaGetPointerState)
1080
1081 popq %rdi // restore state
1082 popq %rsi
1083 popq %rbp
1084 ret
1085
1086
1087 ASM_GLOBAL ASM_PFX(GasketUnixEnableInterrupt)
1088 ASM_PFX(GasketUnixEnableInterrupt):
1089 pushq %rbp // stack frame is for the debugger
1090 movq %rsp, %rbp
1091
1092 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1093 pushq %rdi
1094
1095 call ASM_PFX(UnixEnableInterrupt)
1096
1097 popq %rdi // restore state
1098 popq %rsi
1099 popq %rbp
1100 ret
1101
1102 ASM_GLOBAL ASM_PFX(GasketUnixDisableInterrupt)
1103 ASM_PFX(GasketUnixDisableInterrupt):
1104 pushq %rbp // stack frame is for the debugger
1105 movq %rsp, %rbp
1106
1107 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1108 pushq %rdi
1109
1110 call ASM_PFX(UnixDisableInterrupt)
1111
1112 popq %rdi // restore state
1113 popq %rsi
1114 popq %rbp
1115 ret
1116
1117 //
1118 // UNIX ABI to EFI ABI call
1119 //
1120 // UINTN
1121 // ReverseGasketUint64 (
1122 // void *Api,
1123 // UINTN Arg1
1124 // );
1125 ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
1126 ASM_PFX(ReverseGasketUint64):
1127 pushq %rbp // stack frame is for the debugger
1128 movq %rsp, %rbp
1129
1130 movq %rdi, %rax // Swizzle args
1131 movq %rsi, %rcx
1132
1133 subq $32, %rsp // 32-byte shadow space
1134 call *%rax
1135 addq $32, %rsp
1136
1137 popq %rbp
1138 ret
1139
1140 //
1141 // UNIX ABI to EFI ABI call
1142 //
1143 // UINTN
1144 // ReverseGasketUint64Uint64 (
1145 // void *Api,
1146 // UINTN Arg1
1147 // UINTN Arg2
1148 // );
1149 ASM_GLOBAL ASM_PFX(ReverseGasketUint64Uint64)
1150 ASM_PFX(ReverseGasketUint64Uint64):
1151 pushq %rbp // stack frame is for the debugger
1152 movq %rsp, %rbp
1153
1154 movq %rdi, %rax // Swizzle args
1155 movq %rsi, %rcx
1156
1157 subq $32, %rsp // 32-byte shadow space
1158 call *%rax
1159 addq $32, %rsp
1160
1161 popq %rbp
1162 ret
1163
1164
1165 // Sec PPI Callbacks
1166
1167 ASM_GLOBAL ASM_PFX(GasketSecUnixPeiLoadFile)
1168 ASM_PFX(GasketSecUnixPeiLoadFile):
1169 pushq %rbp // stack frame is for the debugger
1170 movq %rsp, %rbp
1171
1172 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1173 pushq %rdi
1174
1175 movq %rcx, %rdi // Swizzle args
1176 movq %rdx, %rsi
1177 movq %r8, %rdx
1178 movq %r9, %rcx
1179
1180 call ASM_PFX(SecUnixPeiLoadFile)
1181
1182 popq %rdi // restore state
1183 popq %rsi
1184 popq %rbp
1185 ret
1186
1187
1188
1189 ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
1190 ASM_PFX(GasketSecUnixPeiAutoScan):
1191 pushq %rbp // stack frame is for the debugger
1192 movq %rsp, %rbp
1193
1194 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1195 pushq %rdi
1196
1197 movq %rcx, %rdi // Swizzle args
1198 movq %rdx, %rsi
1199 movq %r8, %rdx
1200
1201 call ASM_PFX(SecUnixPeiAutoScan)
1202
1203 popq %rdi // restore state
1204 popq %rsi
1205 popq %rbp
1206 ret
1207
1208 ASM_GLOBAL ASM_PFX(GasketSecUnixUnixThunkAddress)
1209 ASM_PFX(GasketSecUnixUnixThunkAddress):
1210 pushq %rbp // stack frame is for the debugger
1211 movq %rsp, %rbp
1212
1213 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1214 pushq %rdi
1215
1216 call ASM_PFX(SecUnixUnixThunkAddress)
1217
1218
1219 popq %rdi
1220 popq %rsi
1221 popq %rbp
1222 ret
1223
1224
1225 ASM_GLOBAL ASM_PFX(GasketSecPeiReportStatusCode)
1226 ASM_PFX(GasketSecPeiReportStatusCode):
1227 pushq %rbp // stack frame is for the debugger
1228 movq %rsp, %rbp
1229
1230 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1231 pushq %rdi
1232
1233 movq %rcx, %rdi // Swizzle args
1234 movq %rdx, %rsi
1235 movq %r8, %rdx
1236 movq %r9, %rcx
1237 movq $0, %r8 // BugBug: This should come from the stack
1238 movq $0, %r9 // But we can cheat since they are optional for bringup....
1239
1240 call ASM_PFX(SecPeiReportStatusCode)
1241
1242 popq %rdi // restore state
1243 popq %rsi
1244 popq %rbp
1245 ret
1246
1247
1248 ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
1249 ASM_PFX(GasketSecUnixFdAddress):
1250 pushq %rbp // stack frame is for the debugger
1251 movq %rsp, %rbp
1252
1253 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1254 pushq %rdi
1255
1256 movq %rcx, %rdi // Swizzle args
1257 movq %rdx, %rsi
1258 movq %r8, %rdx
1259 movq %r9, %rcx
1260
1261 call ASM_PFX(SecUnixFdAddress)
1262
1263 popq %rdi // restore state
1264 popq %rsi
1265 popq %rbp
1266 ret
1267
1268
1269
1270
1271 ASM_GLOBAL ASM_PFX(GasketSecTemporaryRamSupport)
1272 ASM_PFX(GasketSecTemporaryRamSupport):
1273 pushq %rbp // stack frame is for the debugger
1274 movq %rsp, %rbp
1275
1276 pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI
1277 pushq %rdi
1278
1279 movq %rcx, %rdi // Swizzle args
1280 movq %rdx, %rsi
1281 movq %r8, %rdx
1282 movq %r9, %rcx
1283
1284 call ASM_PFX(SecTemporaryRamSupport)
1285
1286 popq %rdi // restore state
1287 popq %rsi
1288 popq %rbp
1289 ret
1290
1291
1292
1293
1294