this repo has no description
at fixPythonPipStalling 116 lines 2.1 kB view raw
1#if defined(__x86_64__) 2 3.macro trampoline_enter 4pushq %rbp 5movq %rsp, %rbp 6 7# Align the stack 8andq $$~15, %rsp 9# There's an odd number of pushq's below 10subq $$8, %rsp 11 12# Re-push possible 7th and 8th arg 13movq 40(%rbp), %r11 14pushq %r11 15movq 32(%rbp), %r11 16pushq %r11 17 18# Push args from 1st to 6th 19pushq %r9 20pushq %r8 21pushq %rcx 22pushq %rdx 23pushq %rsi 24pushq %rdi 25pushq %rax 26 27# Pass the syscall num and the pointer 28# to the on-stack buffer as arguments 29movq %rax, %rdi 30leaq 8(%rsp), %rsi 31.endmacro 32 33.macro trampoline_leave 34# Read back the registers 35popq %rax 36popq %rdi 37popq %rsi 38popq %rdx 39popq %rcx 40popq %r8 41popq %r9 42leave 43ret 44.endmacro 45 46#elif defined(__i386__) 47 48.macro trampoline_enter 49pushl %ebp 50movl %esp, %ebp 51 52# align the stack 53andl $$~15, %esp 54 55#define copy_arg(off) \ 56 movl 16+off(%ebp), %ecx ;\ 57 movl %ecx, -56+off(%esp) 58 59// copy the arguments (same as in syscalls-table.S and darling_mach_syscall.S) 60copy_arg(0) 61copy_arg(4) 62copy_arg(8) 63copy_arg(12) 64copy_arg(16) 65copy_arg(20) 66copy_arg(24) 67copy_arg(28) 68copy_arg(32) 69copy_arg(36) 70copy_arg(40) 71copy_arg(44) 72copy_arg(48) 73copy_arg(52) 74 75# make space on the stack now for the arguments we just copied 76subl $$56, %esp 77 78# push the address of the argument area as the second argument 79pushl %esp 80 81# push the call number or return value as the first argument 82pushl %eax 83.endmacro 84 85.macro trampoline_leave 86# restore eax (i.e. the call number or return value) 87popl %eax 88leave 89ret 90.endmacro 91 92#endif 93 94.private_extern _darling_mach_syscall_entry_trampoline 95_darling_mach_syscall_entry_trampoline: 96 trampoline_enter 97 call _darling_mach_syscall_entry_print 98 trampoline_leave 99 100.private_extern _darling_mach_syscall_exit_trampoline 101_darling_mach_syscall_exit_trampoline: 102 trampoline_enter 103 call _darling_mach_syscall_exit_print 104 trampoline_leave 105 106.private_extern _darling_bsd_syscall_entry_trampoline 107_darling_bsd_syscall_entry_trampoline: 108 trampoline_enter 109 call _darling_bsd_syscall_entry_print 110 trampoline_leave 111 112.private_extern _darling_bsd_syscall_exit_trampoline 113_darling_bsd_syscall_exit_trampoline: 114 trampoline_enter 115 call _darling_bsd_syscall_exit_print 116 trampoline_leave