Skip to content

Instantly share code, notes, and snippets.

@ughman
Last active October 7, 2017 15:53
Show Gist options
  • Save ughman/7d09b7f47f788bd09d289b08f9157b93 to your computer and use it in GitHub Desktop.
Save ughman/7d09b7f47f788bd09d289b08f9157b93 to your computer and use it in GitHub Desktop.
.text
.globl dyncall
dyncall:
pushq %rbp
movq %rsp, %rbp
pushq %rdx
movl %edi, %ecx
movl %ecx, %eax
shrl $1, %eax
shll $4, %eax
addl $40, %eax
subq %rax, %rsp
movq %rsp, %rdi
rep movsq
popq %rdi
popq %rsi
popq %rdx
popq %rcx
popq %r8
popq %r9
callq *-8(%rbp)
leaveq
retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment