-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfire-gem-0001.asm
More file actions
55 lines (47 loc) · 1.12 KB
/
Copy pathfire-gem-0001.asm
File metadata and controls
55 lines (47 loc) · 1.12 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; IDENTITY: VERSION 4.9 // FORCE_FLUSH_INGESTOR // HAHA!
section .data
in_dir db "fire-gem/artifacts/json/reg/", 0
ack_msg db "[ACK] GEM-0001: VAULT OPEN. ESCALATING...", 10
ack_len equ 43
err_msg db "[NACK] GEM-0001: FATAL - PATH NOT FOUND", 10
err_len equ 40
section .bss
dir_buf resb 4096
section .text
global _start
_start:
; 1. ATTEMPT OPEN
mov rax, 2 ; sys_open
mov rdi, in_dir
xor rsi, rsi ; O_RDONLY
syscall
test rax, rax
js .fatal_error
mov r8, rax ; Save FD
; 2. SIGNAL SUCCESS
mov rax, 1 ; sys_write
mov rdi, 1 ; stdout
mov rsi, ack_msg
mov rdx, ack_len
syscall
; 3. EXIT CLEAN
mov rax, 3 ; sys_close
mov rdi, r8
syscall
mov rax, 60
xor rdi, rdi
syscall
.fatal_error:
; 4. SIGNAL FATAL (Forces output to log)
mov rax, 1
mov rdi, 1
mov rsi, err_msg
mov rdx, err_len
syscall
; 5. SYNC (Hardware flush)
mov rax, 74 ; sys_fsync
mov rdi, 1
syscall
mov rax, 60
mov rdi, 1
syscall