GNU >> Assembly (x86)

hello, world! (gs)


參考資訊:
1. syscall
2. how-to-use-sysenter-under-linux

main.s

    .global main
 
    .data
msg: .ascii "hello, world!\n"
len = . - msg
 
    .text
main:
    mov $4, %eax
    mov $1, %ebx
    mov $msg, %ecx
    mov $len, %edx
    call *%gs:0x10
   
    mov $1, %eax
    mov $0, %ebx
    call *%gs:0x10

NRsyscall nameeaxarg0(ebx)arg1(ecx)arg2(edx)
1exit1int error_code
4write4unsigned int fdconst char *bufsize_t count

編譯、執行

$ i686-linux-gnu-gcc main.s -o main -static
$ qemu-i386 ./main
    hello, world!


返回上一頁