20 lines
399 B
NASM
20 lines
399 B
NASM
default rel
|
|
section .rdata
|
|
panic_msg db "panic occured!", 10
|
|
panic_msg_len equ $ - panic_msg
|
|
|
|
extern eprint_str
|
|
|
|
section .text
|
|
global panic
|
|
|
|
;; Abort the program with a default panic message
|
|
panic:
|
|
lea rdi, [panic_msg]
|
|
lea rsi, [panic_msg_len]
|
|
call eprint_str
|
|
; exit with error code 1
|
|
mov rax, 60 ; syscall: exit
|
|
mov rdi, 1 ; status: 1
|
|
syscall
|