카테고리

asm (27) bootloader_x86_grub (1) C (92) compile (11) config (76) CPP (13) CSS (1) debugging (7) gimp (1) Go (1) html (1) Java (1) JavaScript (1) kernel (19) LibreOffice (3) Linux system progamming (21) MFC (1) opencv (4) OpenGL (1) PHP (1) Python (4) qemu (29) shell (3) socket (7) troubleshooting (2) ubuntu18.04 (2) windows (1)

2018/12/06

asm 64bit 문자열

64 bit
global    _start

          section   .text
_start:   mov       rax, 1                  ; 쓰기 위한 시스템 호출
          mov       rdi, 1                  ; 파일 핸들 1은 stdout입니다.
          mov       rsi, message            ; 출력 할 문자열의 주소
          mov       rdx, 13                 ; 바이트 수
          syscall                           ; 쓰기 운여체제 호출
          mov       rax, 60                 ; 빠져나가기 시스템 호출
          xor       rdi, rdi                ; 종료 코드 0
          syscall                           ; 운영체제 종료 호출

          section   .data
message:  db        "Hello, World", 10      ; 개형 문자 \n

compile:
nasm -felf64 hello.asm && ld hello.o && ./a.out

댓글 없음:

댓글 쓰기