about summary refs log tree commit diff stats
path: root/tests/test01.c
blob: 48168fb2878ab0f0fe6d3a13faf6e25729ef8a85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <sys/syscall.h> 
#include <unistd.h>                                      
                                                                                
int main(int argc, char **argv)                                                 
{                                                                               
    const char msg[] = "Hello x86_64 World!\n";
    //syscall(1, STDOUT_FILENO, msg, sizeof(msg)-1);
    asm (
        "mov $1, %%rax \n"
        "mov $1, %%rdi \n"
        "mov %0, %%rsi \n"
        "mov $20, %%rdx \n"
        "syscall \n"
    :
    :"r" (msg)
    :"%rax","%rdi","%rsi","%rdx"
    );
    return 0;                                                                   
}