Created
March 28, 2021 02:35
-
-
Save trietptm/b690f1a42f969ba6feaa203b5f4246de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asm( | |
"mov %0, %%rsi\n\t" | |
"mov %1, %%rdi\n\t" | |
"call _trumpoline\n\t" | |
: | |
: | |
"r" (m_code), "g"(context) | |
: "rsi", "rdi" | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.global _trumpoline | |
_trumpoline: | |
push %rbp | |
push %rax | |
push %rcx | |
push %rdx | |
push %rbx | |
push %rsi | |
push %rdi | |
push %r8 | |
push %r9 | |
push %r10 | |
push %r11 | |
push %r12 | |
push %r13 | |
push %r14 | |
push %r15 | |
callq *%rsi | |
pop %r15 | |
pop %r14 | |
pop %r13 | |
pop %r12 | |
pop %r11 | |
pop %r10 | |
pop %r9 | |
pop %r8 | |
pop %rdi | |
pop %rsi | |
pop %rbx | |
pop %rdx | |
pop %rcx | |
pop %rax | |
pop %rbp | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment