-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
global _start | ||
|
||
section .data | ||
|
||
timespec: | ||
|
||
tv_sec dq 0 | ||
tv_nsec dq 30000000 ; 30 ms | ||
|
||
section .text | ||
|
||
_start: | ||
mov al, 0edh | ||
out 60h, al | ||
|
||
mov rax, 35 | ||
mov rdi, timespec | ||
xor rsi, rsi | ||
syscall | ||
|
||
mov al, 7 | ||
out 60h, al | ||
|
||
mov eax, 60 | ||
xor rdi, rdi | ||
syscall |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
global _start | ||
|
||
section .data | ||
|
||
timespec: | ||
tv_sec dq 3 ; 3 sec | ||
tv_nsec dq 0 | ||
|
||
section .text | ||
|
||
_start: | ||
mov rax, 1 ; system call 1 is write | ||
mov rdi, 1 ; file handle 1 is stdout | ||
mov rsi, message ; address of string to output | ||
mov rdx, 13 ; number of bytes | ||
syscall ; invoke operating system to do the write | ||
|
||
mov rax, 35 ; system call 35 is sleep | ||
mov rdi, timespec | ||
xor rsi, rsi | ||
syscall | ||
|
||
mov rax, 1 ; system call 1 is write | ||
mov rdi, 1 ; file handle 1 is stdout | ||
mov rsi, message ; address of string to output | ||
mov rdx, 13 ; number of bytes | ||
syscall ; invoke operating system to do the write | ||
|
||
mov eax, 60 ; system call 60 is exit | ||
xor rdi, rdi ; exit code 0 | ||
syscall ; invoke operating system to exit | ||
message: | ||
db "Hello, World", 10 ; note the newline at the end | ||
db "Hello, World", 10 ; note the newline at the end |
Binary file not shown.