Last active
August 29, 2015 14:07
-
-
Save totem3/438a5cf79b121978064b 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
#include <stdio.h> | |
int main(int argc, char const* argv[]) | |
{ | |
printf("Hello World!\n"); | |
return 0; | |
} |
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
#define INLINE_SYSCALL(name, nr, args...) \ | |
({ \ | |
unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ | |
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ | |
{ \ | |
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ | |
resultvar = 0xffffffff; \ | |
} \ | |
(int) resultvar; }) | |
# define INTERNAL_SYSCALL(name, err, nr, args...) \ | |
({ \ | |
register unsigned int resultvar; \ | |
EXTRAVAR_##nr \ | |
asm volatile ( \ | |
LOADARGS_##nr \ | |
"movl %1, %%eax\n\t" \ | |
"int $0x80\n\t" \ | |
RESTOREARGS_##nr \ | |
: "=a" (resultvar) \ | |
: "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc"); \ | |
(int) resultvar; }) | |
/* | |
* # define LOADARGS_3 \ | |
* "xchgl %%ebx, %%edi\n\t" | |
* | |
* # define RESTOREARGS_3 \ | |
* "xchgl %%edi, %%ebx\n\t" | |
* | |
* __NR_execve = 11 (unistd.h) | |
* | |
* # define ASMFMT_3(arg1, arg2, arg3) \ | |
* , "b" (arg1), "c" (arg2), "d" (arg3) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment