Created
May 15, 2020 02:33
-
-
Save wenxingxing/3876483e173b3986a15fe6f2e34bb7d2 to your computer and use it in GitHub Desktop.
This file contains 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
int foo(char* x, char*, int a, int b) { return a + b; } | |
typedef int (*func)(int, int); | |
int main() { | |
int a = 10, b = 20, c = 0; | |
void* p = (void*)foo; | |
__asm__ __volatile__( | |
"movl %%edx,%%esi; " | |
"movl %%ecx, %%edi; " | |
"call *%%rax;" | |
: "=a"(c) | |
: "d"(a), "c"(b), "a"(p)); | |
cout << c << endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment