Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
proffix4 authored May 30, 2022
1 parent 828d3e8 commit c0f735a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
26 changes: 26 additions & 0 deletions demos_x64/demo2_x64.asm
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 added demos_x64/demo2_x64.elf
Binary file not shown.
20 changes: 19 additions & 1 deletion demos_x64/demo_x64.asm
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 modified demos_x64/demo_x64.elf
Binary file not shown.

0 comments on commit c0f735a

Please sign in to comment.