Skip to content

Instantly share code, notes, and snippets.

@lzpel
Last active October 17, 2021 02:26
Show Gist options
  • Save lzpel/55216b0d56232b343cc2cab77045d764 to your computer and use it in GitHub Desktop.
Save lzpel/55216b0d56232b343cc2cab77045d764 to your computer and use it in GitHub Desktop.
x64 linux only. `gcc helloworld_in_extended_asm.c ; ./a.out`
int main(void){
const char mes[] = "hello, world\n\0";
asm volatile(
"movq %0, %%rsi \n\t movq %1, %%rdx \n\t movq $1, %%rax \n\t movq $1, %%rdi \n\t syscall"
:
:"r"(mes),"r"(sizeof(mes))
:
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment