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