queck #6357(2008/05/27 10:26 GMT) [ Other ] Rating0/0=0.00
64bit Linux で NASM によるアセンブラです。 64bit ではシステムコールは int 0x80 ではなく syscall を使います。システムコール番号も違い、システムコールで使うレジスタも次の順番になります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
;;; nasm -f elf64 hello.asm && ld -o hello hello.o && ./hello bits 64 section .text global _start _start: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, len syscall mov rax, 60 xor rdi, rdi syscall section .data msg db 'Hello, world!' len equ $ - msg
Rating0/0=0.00-0+
[ reply ]
queck
#6357()
[
Other
]
Rating0/0=0.00
64bit Linux で NASM によるアセンブラです。 64bit ではシステムコールは int 0x80 ではなく syscall を使います。システムコール番号も違い、システムコールで使うレジスタも次の順番になります。
;;; nasm -f elf64 hello.asm && ld -o hello hello.o && ./hello bits 64 section .text global _start _start: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, len syscall mov rax, 60 xor rdi, rdi syscall section .data msg db 'Hello, world!' len equ $ - msgRating0/0=0.00-0+
[ reply ]