]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/Sec/Ia32/Gasket.S
Add Sec/Ia32/Gasket.S
[mirror_edk2.git] / UnixPkg / Sec / Ia32 / Gasket.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2008 - 2009 Apple Inc. All rights reserved.
4 # All rights reserved. This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php
8 #
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 #
12 # Abstract:
13 #
14 # OS X Application requires 16 byte stack alignment. The problem is these
15 # APIs are exposed to code that does not have this requirement via
16 # EFI_UNIX_THUNK_PROTOCOL. So these are wrapper functions that make sure
17 # the stack is aligned. This code should also work if the stack is already
18 # aligned. Extra stack padding is really the same as local varaibles so
19 # it gets freed by the leave instruction
20 #
21 # I basically used the compiler, added extra 16 bytes to the local stack and
22 # made sure %esp ended in 0 before the call (16 byte algined)
23 #
24 # cat t.c
25 ##include <stdio.h>
26 ##include <sys/stat.h>
27 #
28 #int chmod (int fd, mode_t len){
29 # long m = (long)fd;
30 #}
31 #
32 #int Gasketchmod (int fd, mode_t len){
33 # return chmod (fd, len);
34 #}
35 #
36 # gcc -S t.c
37 # cat t.s
38 # this gives you the starting point....
39 #
40 #
41 #------------------------------------------------------------------------------
42
43 #include <ProcessorBind.h>
44
45 .text
46
47 #
48 #
49 # EFI_UNIX_THUNK_PROTOCOL that gets exported
50 #
51 #
52
53 #------------------------------------------------------------------------------
54 # VOID GasketmsSleep (unsigned long Milliseconds);
55 #------------------------------------------------------------------------------
56 .globl _GasketmsSleep
57 _GasketmsSleep:
58 pushl %ebp
59 movl %esp, %ebp
60 subl $40, %esp # sub extra 0x10 from the stack for the AND
61 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
62 movl 8(%ebp), %eax
63 movl %eax, (%esp)
64 call _msSleep
65 leave
66 ret
67
68
69 #------------------------------------------------------------------------------
70 # void Gasketexit (int status);
71 #------------------------------------------------------------------------------
72 .globl _Gasketexit
73 _Gasketexit:
74 pushl %ebp
75 movl %esp, %ebp
76 subl $40, %esp # sub extra 0x10 from the stack for the AND
77 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
78 movl 8(%ebp), %eax
79 movl %eax, (%esp)
80 call _exit
81 leave
82 ret
83
84
85 #------------------------------------------------------------------------------
86 # void GasketSetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));
87 #------------------------------------------------------------------------------
88 .globl _GasketSetTimer
89 _GasketSetTimer:
90 pushl %ebp
91 movl %esp, %ebp
92 subl $56, %esp # sub extra 0x10 from the stack for the AND
93 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
94 movl 8(%ebp), %eax
95 movl %eax, -16(%ebp)
96 movl 12(%ebp), %eax
97 movl %eax, -12(%ebp)
98 movl 16(%ebp), %eax
99 movl %eax, 8(%esp)
100 movl -16(%ebp), %eax
101 movl -12(%ebp), %edx
102 movl %eax, (%esp)
103 movl %edx, 4(%esp)
104 call _SetTimer
105 leave
106 ret
107
108
109
110 #------------------------------------------------------------------------------
111 # void GasketGetLocalTime (EFI_TIME *Time);
112 #------------------------------------------------------------------------------
113 .globl _GasketGetLocalTime
114 _GasketGetLocalTime:
115 pushl %ebp
116 movl %esp, %ebp
117 subl $40, %esp # sub extra 0x10 from the stack for the AND
118 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
119 movl 8(%ebp), %eax
120 movl %eax, (%esp)
121 call _GetLocalTime
122 leave
123 ret
124
125
126
127 #------------------------------------------------------------------------------
128 # struct tm *Gasketgmtime (const time_t *clock);
129 #------------------------------------------------------------------------------
130 .globl _Gasketgmtime
131 _Gasketgmtime:
132 pushl %ebp
133 movl %esp, %ebp
134 subl $40, %esp # sub extra 0x10 from the stack for the AND
135 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
136 movl 8(%ebp), %eax
137 movl %eax, (%esp)
138 call _gmtime
139 leave
140 ret
141
142
143
144
145 #------------------------------------------------------------------------------
146 # long GasketGetTimeZone(void);
147 #------------------------------------------------------------------------------
148 .globl _GasketGetTimeZone
149 _GasketGetTimeZone:
150 pushl %ebp
151 movl %esp, %ebp
152 subl $24, %esp # sub extra 0x10 from the stack for the AND
153 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
154 call _GetTimeZone
155 leave
156 ret
157
158
159 #------------------------------------------------------------------------------
160 # int GasketGetDayLight (void);
161 #------------------------------------------------------------------------------
162 .globl _GasketGetDayLight
163 _GasketGetDayLight:
164 pushl %ebp
165 movl %esp, %ebp
166 subl $24, %esp # sub extra 0x10 from the stack for the AND
167 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
168 call _GetDayLight
169 leave
170 ret
171
172
173
174 #------------------------------------------------------------------------------
175 # int Gasketpoll (struct pollfd *pfd, int nfds, int timeout);
176 #------------------------------------------------------------------------------
177 .globl _Gasketpoll
178 _Gasketpoll:
179 pushl %ebp
180 movl %esp, %ebp
181 subl $56, %esp # sub extra 0x10 from the stack for the AND
182 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
183 movl 16(%ebp), %eax
184 movl %eax, 8(%esp)
185 movl 12(%ebp), %eax
186 movl %eax, 4(%esp)
187 movl 8(%ebp), %eax
188 movl %eax, (%esp)
189 call _poll
190 leave
191 ret
192
193
194
195 #------------------------------------------------------------------------------
196 # int Gasketread (int fd, void *buf, int count);
197 #------------------------------------------------------------------------------
198 .globl _Gasketread
199 _Gasketread:
200 pushl %ebp
201 movl %esp, %ebp
202 subl $56, %esp # sub extra 0x10 from the stack for the AND
203 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
204 movl 16(%ebp), %eax
205 movl %eax, 8(%esp)
206 movl 12(%ebp), %eax
207 movl %eax, 4(%esp)
208 movl 8(%ebp), %eax
209 movl %eax, (%esp)
210 call _read
211 leave
212 ret
213
214
215 #------------------------------------------------------------------------------
216 # int Gasketwrite (int fd, const void *buf, int count);
217 #------------------------------------------------------------------------------
218 .globl _Gasketwrite
219 _Gasketwrite:
220 pushl %ebp
221 movl %esp, %ebp
222 subl $56, %esp # sub extra 0x10 from the stack for the AND
223 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
224 movl 16(%ebp), %eax
225 movl %eax, 8(%esp)
226 movl 12(%ebp), %eax
227 movl %eax, 4(%esp)
228 movl 8(%ebp), %eax
229 movl %eax, (%esp)
230 call _write
231 leave
232 ret
233
234
235
236 #------------------------------------------------------------------------------
237 # char *Gasketgetenv (const char *name);
238 #------------------------------------------------------------------------------
239 .globl _Gasketgetenv
240 _Gasketgetenv:
241 pushl %ebp
242 movl %esp, %ebp
243 subl $40, %esp # sub extra 0x10 from the stack for the AND
244 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
245 movl 8(%ebp), %eax
246 movl %eax, (%esp)
247 call _getenv
248 leave
249 ret
250
251
252
253 #------------------------------------------------------------------------------
254 # int Gasketopen (const char *name, int flags, int mode);
255 #------------------------------------------------------------------------------
256 .globl _Gasketopen
257 _Gasketopen:
258 pushl %ebp
259 movl %esp, %ebp
260 subl $56, %esp # sub extra 0x10 from the stack for the AND
261 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
262 movl 16(%ebp), %eax
263 movl %eax, 8(%esp)
264 movl 12(%ebp), %eax
265 movl %eax, 4(%esp)
266 movl 8(%ebp), %eax
267 movl %eax, (%esp)
268 call _open
269 leave
270 ret
271
272
273
274 #------------------------------------------------------------------------------
275 # off_t Gasketlseek (int fd, off_t off, int whence);
276 #------------------------------------------------------------------------------
277 .globl _Gasketlseek
278 _Gasketlseek:
279 pushl %ebp
280 movl %esp, %ebp
281 subl $56, %esp # sub extra 0x10 from the stack for the AND
282 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
283 movl 12(%ebp), %eax
284 movl %eax, -16(%ebp)
285 movl 16(%ebp), %eax
286 movl %eax, -12(%ebp)
287 movl 20(%ebp), %eax
288 movl %eax, 12(%esp)
289 movl -16(%ebp), %eax
290 movl -12(%ebp), %edx
291 movl %eax, 4(%esp)
292 movl %edx, 8(%esp)
293 movl 8(%ebp), %eax
294 movl %eax, (%esp)
295 call _lseek
296 leave
297 ret
298
299
300
301 #------------------------------------------------------------------------------
302 # int Gasketftruncate (int fd, long int len);
303 #------------------------------------------------------------------------------
304 .globl _Gasketftruncate
305 _Gasketftruncate:
306 pushl %ebp
307 movl %esp, %ebp
308 subl $40, %esp # sub extra 0x10 from the stack for the AND
309 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
310 movl 12(%ebp), %eax
311 movl %eax, 4(%esp)
312 movl 8(%ebp), %eax
313 movl %eax, (%esp)
314 call _truncate
315 leave
316 ret
317
318
319
320 #------------------------------------------------------------------------------
321 # int Gasketclose (int fd);
322 #------------------------------------------------------------------------------
323 .globl _Gasketclose
324 _Gasketclose:
325 pushl %ebp
326 movl %esp, %ebp
327 subl $40, %esp # sub extra 0x10 from the stack for the AND
328 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
329 movl 8(%ebp), %eax
330 movl %eax, (%esp)
331 call _close
332 leave
333 ret
334
335
336
337 #------------------------------------------------------------------------------
338 # int Gasketmkdir (const char *pathname, mode_t mode);
339 #------------------------------------------------------------------------------
340 .globl _Gasketmkdir
341 _Gasketmkdir:
342 pushl %ebp
343 movl %esp, %ebp
344 subl $40, %esp # sub extra 0x10 from the stack for the AND
345 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
346 movl 12(%ebp), %eax
347 movl %eax, 4(%esp)
348 movl 8(%ebp), %eax
349 movl %eax, (%esp)
350 call _mkdir
351 leave
352 ret
353
354
355
356 #------------------------------------------------------------------------------
357 # int Gasketrmdir (const char *pathname);
358 #------------------------------------------------------------------------------
359 .globl _Gasketrmdir
360 _Gasketrmdir:
361 pushl %ebp
362 movl %esp, %ebp
363 subl $40, %esp # sub extra 0x10 from the stack for the AND
364 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
365 movl 8(%ebp), %eax
366 movl %eax, (%esp)
367 call _rmdir
368 leave
369 ret
370
371
372
373 #------------------------------------------------------------------------------
374 # int Gasketunlink (const char *pathname);
375 #------------------------------------------------------------------------------
376 .globl _Gasketunlink
377 _Gasketunlink:
378 pushl %ebp
379 movl %esp, %ebp
380 subl $40, %esp # sub extra 0x10 from the stack for the AND
381 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
382 movl 8(%ebp), %eax
383 movl %eax, (%esp)
384 call _unlink
385 leave
386 ret
387
388
389
390 #------------------------------------------------------------------------------
391 # int GasketGetErrno (void);
392 #------------------------------------------------------------------------------
393 .globl _GasketGetErrno
394 _GasketGetErrno:
395 pushl %ebp
396 movl %esp, %ebp
397 subl $24, %esp # sub extra 0x10 from the stack for the AND
398 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
399 call _GetErrno
400 leave
401 ret
402
403
404
405 #------------------------------------------------------------------------------
406 # DIR *Gasketopendir (const char *pathname);
407 #------------------------------------------------------------------------------
408 .globl _Gasketopendir
409 _Gasketopendir:
410 pushl %ebp
411 movl %esp, %ebp
412 subl $40, %esp # sub extra 0x10 from the stack for the AND
413 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
414 movl 8(%ebp), %eax
415 movl %eax, (%esp)
416 call _opendir
417 leave
418 ret
419
420
421
422 #------------------------------------------------------------------------------
423 # void *Gasketrewinddir (DIR *dir);
424 #------------------------------------------------------------------------------
425 .globl _Gasketrewinddir
426 _Gasketrewinddir:
427 pushl %ebp
428 movl %esp, %ebp
429 subl $40, %esp # sub extra 0x10 from the stack for the AND
430 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
431 movl 8(%ebp), %eax
432 movl %eax, (%esp)
433 call _rewinddir
434 leave
435 ret
436
437
438
439 #------------------------------------------------------------------------------
440 # struct dirent *Gasketreaddir (DIR *dir);
441 #------------------------------------------------------------------------------
442 .globl _Gasketreaddir
443 _Gasketreaddir:
444 pushl %ebp
445 movl %esp, %ebp
446 subl $40, %esp # sub extra 0x10 from the stack for the AND
447 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
448 movl 8(%ebp), %eax
449 movl %eax, (%esp)
450 call _readdir
451 leave
452 ret
453
454
455
456 #------------------------------------------------------------------------------
457 # int Gasketclosedir (DIR *dir);
458 #------------------------------------------------------------------------------
459 .globl _Gasketclosedir
460 _Gasketclosedir:
461 pushl %ebp
462 movl %esp, %ebp
463 subl $40, %esp # sub extra 0x10 from the stack for the AND
464 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
465 movl 8(%ebp), %eax
466 movl %eax, (%esp)
467 call _closedir
468 leave
469 ret
470
471
472
473 #------------------------------------------------------------------------------
474 # int Gasketstat (const char *path, struct stat *buf);
475 #------------------------------------------------------------------------------
476 .globl _Gasketstat
477 _Gasketstat:
478 pushl %ebp
479 movl %esp, %ebp
480 subl $40, %esp # sub extra 0x10 from the stack for the AND
481 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
482 movl 12(%ebp), %eax
483 movl %eax, 4(%esp)
484 movl 8(%ebp), %eax
485 movl %eax, (%esp)
486 call _stat
487 leave
488 ret
489
490
491
492 #------------------------------------------------------------------------------
493 # int Gasketstatfs (const char *path, struct statfs *buf);
494 #------------------------------------------------------------------------------
495 .globl _Gasketstatfs
496 _Gasketstatfs:
497 pushl %ebp
498 movl %esp, %ebp
499 subl $40, %esp # sub extra 0x10 from the stack for the AND
500 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
501 movl 12(%ebp), %eax
502 movl %eax, 4(%esp)
503 movl 8(%ebp), %eax
504 movl %eax, (%esp)
505 call _statfs
506 leave
507 ret
508
509
510
511
512 #------------------------------------------------------------------------------
513 # int Gasketrename (const char *oldpath, const char *newpath);
514 #------------------------------------------------------------------------------
515 .globl _Gasketrename
516 _Gasketrename:
517 pushl %ebp
518 movl %esp, %ebp
519 subl $40, %esp # sub extra 0x10 from the stack for the AND
520 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
521 movl 12(%ebp), %eax
522 movl %eax, 4(%esp)
523 movl 8(%ebp), %eax
524 movl %eax, (%esp)
525 call _rename
526 leave
527 ret
528
529
530
531
532 #------------------------------------------------------------------------------
533 # time_t Gasketmktime (struct tm *tm);
534 #------------------------------------------------------------------------------
535 .globl _Gasketmktime
536 _Gasketmktime:
537 pushl %ebp
538 movl %esp, %ebp
539 subl $40, %esp # sub extra 0x10 from the stack for the AND
540 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
541 movl 8(%ebp), %eax
542 movl %eax, (%esp)
543 call _mktime
544 leave
545 ret
546
547
548
549 #------------------------------------------------------------------------------
550 # int Gasketfsync (int fd);
551 #------------------------------------------------------------------------------
552 .globl _Gasketfsync
553 _Gasketfsync:
554 pushl %ebp
555 movl %esp, %ebp
556 subl $40, %esp # sub extra 0x10 from the stack for the AND
557 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
558 movl 8(%ebp), %eax
559 movl %eax, (%esp)
560 call _fsync
561 leave
562 ret
563
564
565
566 #------------------------------------------------------------------------------
567 # int Gasketchmod (const char *path, mode_t mode);
568 #------------------------------------------------------------------------------
569 .globl _Gasketchmod
570 _Gasketchmod:
571 pushl %ebp
572 movl %esp, %ebp
573 subl $56, %esp # sub extra 0x10 from the stack for the AND
574 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
575 movl 12(%ebp), %eax
576 movw %ax, -12(%ebp)
577 movzwl -12(%ebp), %eax
578 movl %eax, 4(%esp)
579 movl 8(%ebp), %eax
580 movl %eax, (%esp)
581 call _chmod
582 leave
583 ret
584
585 #------------------------------------------------------------------------------
586 # int Gasketutime (const char *filename, const struct utimbuf *buf);
587 #------------------------------------------------------------------------------
588 .globl _Gasketutime
589 _Gasketutime:
590 pushl %ebp
591 movl %esp, %ebp
592 subl $40, %esp # sub extra 0x10 from the stack for the AND
593 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
594 movl 12(%ebp), %eax
595 movl %eax, 4(%esp)
596 movl 8(%ebp), %eax
597 movl %eax, (%esp)
598 call _rename
599 leave
600 ret
601
602
603
604 #------------------------------------------------------------------------------
605 # int Gaskettcflush (int fildes, int queue_selector);
606 #------------------------------------------------------------------------------
607 .globl _Gaskettcflush
608 _Gaskettcflush:
609 pushl %ebp
610 movl %esp, %ebp
611 subl $40, %esp # sub extra 0x10 from the stack for the AND
612 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
613 movl 12(%ebp), %eax
614 movl %eax, 4(%esp)
615 movl 8(%ebp), %eax
616 movl %eax, (%esp)
617 call _rename
618 leave
619 ret
620
621
622 #------------------------------------------------------------------------------
623 # EFI_STATUS UgaCreate (struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title);
624 #------------------------------------------------------------------------------
625 .globl _GasketUgaCreate
626 _GasketUgaCreate:
627 pushl %ebp
628 movl %esp, %ebp
629 subl $40, %esp #sub extra 0x10 from the stack for the AND
630 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
631 movl 12(%ebp), %eax
632 movl %eax, 4(%esp)
633 movl 8(%ebp), %eax
634 movl %eax, (%esp)
635 call _UgaCreate
636 leave
637 ret
638
639
640 #------------------------------------------------------------------------------
641 # void Gasketperror (__const char *__s);
642 #------------------------------------------------------------------------------
643 .globl _Gasketperror
644 _Gasketperror:
645 pushl %ebp
646 movl %esp, %ebp
647 subl $40, %esp # sub extra 0x10 from the stack for the AND
648 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
649 movl 8(%ebp), %eax
650 movl %eax, (%esp)
651 call _perror
652 leave
653 ret
654
655
656
657 #------------------------------------------------------------------------------
658 # int Gasketioctl (int fd, unsigned long int __request, ...);
659 #
660 # ... is really int or pointer to structure, so we can treat like an int
661 #
662 #------------------------------------------------------------------------------
663 .globl _Gasketioctl
664 _Gasketioctl:
665 pushl %ebp
666 movl %esp, %ebp
667 subl $40, %esp # sub extra 0x10 from the stack for the AND
668 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
669 movl 16(%ebp), %eax
670 movl %eax, 8(%esp)
671 movl 12(%ebp), %eax
672 movl %eax, 4(%esp)
673 movl 8(%ebp), %eax
674 movl %eax, (%esp)
675 call _ioctl
676 leave
677 ret
678
679
680
681 #------------------------------------------------------------------------------
682 # int Gasketfcntl (int __fd, int __cmd, ...);
683 #
684 # ... is really int or pointer to structure, so we can treat like an int
685 #
686 #------------------------------------------------------------------------------
687 .globl _Gasketfcntl
688 _Gasketfcntl:
689 pushl %ebp
690 movl %esp, %ebp
691 subl $40, %esp # sub extra 0x10 from the stack for the AND
692 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
693 movl 16(%ebp), %eax
694 movl %eax, 8(%esp)
695 movl 12(%ebp), %eax
696 movl %eax, 4(%esp)
697 movl 8(%ebp), %eax
698 movl %eax, (%esp)
699 call _fcntl
700 leave
701 ret
702
703
704
705 #------------------------------------------------------------------------------
706 # int Gasketcfsetispeed (struct termios *__termios_p, speed_t __speed);
707 #------------------------------------------------------------------------------
708 .globl _Gasketcfsetispeed
709 _Gasketcfsetispeed:
710 pushl %ebp
711 movl %esp, %ebp
712 subl $40, %esp # sub extra 0x10 from the stack for the AND
713 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
714 movl 12(%ebp), %eax
715 movl %eax, 4(%esp)
716 movl 8(%ebp), %eax
717 movl %eax, (%esp)
718 call _cfsetispeed
719 leave
720 ret
721
722
723
724 #------------------------------------------------------------------------------
725 # int Gasketcfsetospeed (struct termios *__termios_p, speed_t __speed);
726 #------------------------------------------------------------------------------
727 .globl _Gasketcfsetospeed
728 _Gasketcfsetospeed:
729 pushl %ebp
730 movl %esp, %ebp
731 subl $40, %esp # sub extra 0x10 from the stack for the AND
732 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
733 movl 12(%ebp), %eax
734 movl %eax, 4(%esp)
735 movl 8(%ebp), %eax
736 movl %eax, (%esp)
737 call _cfsetospeed
738 leave
739 ret
740
741
742
743 #------------------------------------------------------------------------------
744 # int Gaskettcgetattr (int __fd, struct termios *__termios_p);
745 #------------------------------------------------------------------------------
746 .globl _Gaskettcgetattr
747 _Gaskettcgetattr:
748 pushl %ebp
749 movl %esp, %ebp
750 subl $40, %esp # sub extra 0x10 from the stack for the AND
751 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
752 movl 12(%ebp), %eax
753 movl %eax, 4(%esp)
754 movl 8(%ebp), %eax
755 movl %eax, (%esp)
756 call _tcgetattr
757 leave
758 ret
759
760
761
762 #------------------------------------------------------------------------------
763 # int Gaskettcsetattr (int __fd, int __optional_actions, __const struct termios *__termios_p);
764 #------------------------------------------------------------------------------
765 .globl _Gaskettcsetattr
766 _Gaskettcsetattr:
767 pushl %ebp
768 movl %esp, %ebp
769 subl $40, %esp # sub extra 0x10 from the stack for the AND
770 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
771 movl 16(%ebp), %eax
772 movl %eax, 8(%esp)
773 movl 12(%ebp), %eax
774 movl %eax, 4(%esp)
775 movl 8(%ebp), %eax
776 movl %eax, (%esp)
777 call _tcsetattr
778 leave
779 ret
780
781 #------------------------------------------------------------------------------
782 # int Gasketsigaction (int sig, const struct sigaction *act, struct sigaction *oact);
783 #------------------------------------------------------------------------------
784 .globl _Gasketsigaction
785 _Gasketsigaction:
786 pushl %ebp
787 movl %esp, %ebp
788 subl $40, %esp # sub extra 0x10 from the stack for the AND
789 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
790 movl 16(%ebp), %eax
791 movl %eax, 8(%esp)
792 movl 12(%ebp), %eax
793 movl %eax, 4(%esp)
794 movl 8(%ebp), %eax
795 movl %eax, (%esp)
796 call _sigaction
797 leave
798 ret
799
800
801 #------------------------------------------------------------------------------
802 # int Gasketsetcontext (const ucontext_t *ucp);
803 #------------------------------------------------------------------------------
804 .globl _Gasketsetcontext
805 _Gasketsetcontext:
806 pushl %ebp
807 movl %esp, %ebp
808 subl $40, %esp # sub extra 0x10 from the stack for the AND
809 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
810 movl 8(%ebp), %eax
811 movl %eax, (%esp)
812 call _setcontext
813 leave
814 ret
815
816 #------------------------------------------------------------------------------
817 # int Gasketgetcontext (ucontext_t *ucp);
818 #------------------------------------------------------------------------------
819 .globl _Gasketgetcontext
820 _Gasketgetcontext:
821 pushl %ebp
822 movl %esp, %ebp
823 subl $40, %esp # sub extra 0x10 from the stack for the AND
824 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
825 movl 8(%ebp), %eax
826 movl %eax, (%esp)
827 call _getcontext
828 leave
829 ret
830
831 #------------------------------------------------------------------------------
832 # int Gasketsigemptyset (sigset_t *set);
833 #------------------------------------------------------------------------------
834 .globl _Gasketsigemptyset
835 _Gasketsigemptyset:
836 pushl %ebp
837 movl %esp, %ebp
838 subl $40, %esp # sub extra 0x10 from the stack for the AND
839 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
840 movl 8(%ebp), %eax
841 movl %eax, (%esp)
842 call _sigemptyset
843 leave
844 ret
845
846
847 #------------------------------------------------------------------------------
848 # int Gasketsigaltstack (const stack_t *ss, stack_t *oss);
849 #------------------------------------------------------------------------------
850 .globl _Gasketsigaltstack
851 _Gasketsigaltstack:
852 pushl %ebp
853 movl %esp, %ebp
854 subl $40, %esp # sub extra 0x10 from the stack for the AND
855 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
856 movl 12(%ebp), %eax
857 movl %eax, 4(%esp)
858 movl 8(%ebp), %eax
859 movl %eax, (%esp)
860 call _sigaltstack
861 leave
862 ret
863
864 #
865 #
866 # UGA Functions that get exported
867 #
868 #
869
870 #------------------------------------------------------------------------------
871 # EFI_STATUS GasketUgaClose (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo);
872 #------------------------------------------------------------------------------
873 .globl _GasketUgaClose
874 _GasketUgaClose:
875 pushl %ebp
876 movl %esp, %ebp
877 subl $40, %esp # sub extra 0x10 from the stack for the AND
878 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
879 movl 8(%ebp), %eax
880 movl %eax, (%esp)
881 call _UgaClose
882 leave
883 ret
884
885 #------------------------------------------------------------------------------
886 # EFI_STATUS GasketUgaSize (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, UINT32 Width, UINT32 Height);
887 #------------------------------------------------------------------------------
888 .globl _GasketUgaSize
889 _GasketUgaSize:
890 pushl %ebp
891 movl %esp, %ebp
892 subl $40, %esp
893 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
894 movl 16(%ebp), %eax
895 movl %eax, 8(%esp)
896 movl 12(%ebp), %eax
897 movl %eax, 4(%esp)
898 movl 8(%ebp), %eax
899 movl %eax, (%esp)
900 call _UgaSize
901 leave
902 ret
903
904
905 #------------------------------------------------------------------------------
906 # EFI_STATUS GasketUgaCheckKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo);
907 #------------------------------------------------------------------------------
908 .globl _GasketUgaCheckKey
909 _GasketUgaCheckKey:
910 pushl %ebp
911 movl %esp, %ebp
912 subl $40, %esp # sub extra 0x10 from the stack for the AND
913 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
914 movl 8(%ebp), %eax
915 movl %eax, (%esp)
916 call _UgaCheckKey
917 leave
918 ret
919
920 #------------------------------------------------------------------------------
921 # EFI_STATUS GasketUgaGetKey (EFI_UNIX_UGA_IO_PROTOCOL *UgaIo, EFI_INPUT_KEY *key);
922 #------------------------------------------------------------------------------
923 .globl _GasketUgaGetKey
924 _GasketUgaGetKey:
925 pushl %ebp
926 movl %esp, %ebp
927 subl $40, %esp #sub extra 0x10 from the stack for the AND
928 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
929 movl 12(%ebp), %eax
930 movl %eax, 4(%esp)
931 movl 8(%ebp), %eax
932 movl %eax, (%esp)
933 call _UgaGetKey
934 leave
935 ret
936
937
938 #------------------------------------------------------------------------------
939 # EFI_STATUS
940 # GasketUgaBlt(
941 # EFI_UNIX_UGA_IO_PROTOCOL *UgaIo,
942 # IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
943 # IN EFI_UGA_BLT_OPERATION BltOperation,
944 # IN UINTN SourceX,
945 # IN UINTN SourceY,
946 # IN UINTN DestinationX,
947 # IN UINTN DestinationY,
948 # IN UINTN Width,
949 # IN UINTN Height,
950 # IN UINTN Delta OPTIONAL
951 # );
952 #------------------------------------------------------------------------------
953 .globl _GasketUgaBlt
954 _GasketUgaBlt:
955 pushl %ebp
956 movl %esp, %ebp
957 subl $88, %esp #sub extra 0x10 from the stack for the AND
958 and $-16, %esp # stack needs to end in 0xFFFFFFF0 before call
959 movl $0, -12(%ebp)
960 movl 44(%ebp), %eax
961 movl %eax, 36(%esp)
962 movl 40(%ebp), %eax
963 movl %eax, 32(%esp)
964 movl 36(%ebp), %eax
965 movl %eax, 28(%esp)
966 movl 32(%ebp), %eax
967 movl %eax, 24(%esp)
968 movl 28(%ebp), %eax
969 movl %eax, 20(%esp)
970 movl 24(%ebp), %eax
971 movl %eax, 16(%esp)
972 movl 20(%ebp), %eax
973 movl %eax, 12(%esp)
974 movl 16(%ebp), %eax
975 movl %eax, 8(%esp)
976 movl 12(%ebp), %eax
977 movl %eax, 4(%esp)
978 movl 8(%ebp), %eax
979 movl %eax, (%esp)
980 call _UgaBlt
981 leave
982 ret
983