-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello64.asm
More file actions
25 lines (18 loc) · 913 Bytes
/
hello64.asm
File metadata and controls
25 lines (18 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
; Hello World Assembly Version (IA-64)
; using POSIX syscalls 0x01 (write), 0x3C (exit)
global _start ; define entry label
section .text
_start:
; write the string buffer to STDOUT via write() POSIX systemcall
mov rax, 0x01 ; invoke write64() syscall
mov rdi, 0x01 ; set file descriptor STDOUT_FILENO to STDOUT(1)
mov rsi, helloText ; pointer to the string buffer
mov rdx, helloLen ; size of the buffer
syscall ; request a write
; Quit the program in an orderly fashion:
mov rax, 0x3C ; invoke exit64() syscall
mov rdi, 0x00 ; set exit value (0 = EXIT_SUCCESS)
syscall ; request termination
section .rodata
helloText: db 'This is a write() 64bit syscall!', 0x0A ; Output, followed by "\n" character
helloLen: equ $ - helloText ; get sizeof(helloText), needed for write() later