1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
.section .text .global _syscall .type _syscall, @function _syscall: push %ebx // preserve registers push %esi push %edi // note: i could squeeze out another parameter out of %ebp mov 16(%esp), %eax mov 20(%esp), %ebx mov %esp, %ecx mov $_syscall_ret, %edx mov 24(%esp), %esi mov 28(%esp), %edi sysenter _syscall_ret: pop %edi pop %esi pop %ebx ret