Skip to content

Instantly share code, notes, and snippets.

Created September 17, 2014 00:43
Show Gist options
  • Save anonymous/1358f69b8d0c8a2ce803 to your computer and use it in GitHub Desktop.
Save anonymous/1358f69b8d0c8a2ce803 to your computer and use it in GitHub Desktop.
test.c
char* str = "Hello world!\n";
void print(){
asm( "mov $13, %%edx \n\t"
"mov %0, %%ecx \n\t"
"mov $0, %%ebx \n\t"
"mov $4, %%eax \n\t"
"int $0x80 \n\t"
::"r"(str):"edx", "ecx", "ebx");
}
void exit(){
asm( "mov $42, %ebx \n\t"
"mov $1, %eax \n\t"
"int $0x80 \n\t" );
}
void nomain(){
print();
exit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment