...
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
.intel_Syntax noprefix
|
||||
.section .text
|
||||
.intel_syntax noprefix
|
||||
|
||||
# func nub_panic(message: ^u8, message_length: u64): void
|
||||
.global nub_panic
|
||||
nub_panic:
|
||||
mov rdx, rsi
|
||||
mov rsi, rdi
|
||||
mov rax, 1
|
||||
mov rdi, 2
|
||||
.section .data
|
||||
.align 8
|
||||
array_out_of_bounds:
|
||||
.ascii "Index is out of bounds of array\n"
|
||||
|
||||
.section .text
|
||||
.global nub_panic_array_oob
|
||||
nub_panic_array_oob:
|
||||
mov rax, 1 # syscall = sys_write
|
||||
mov rdi, 2 # fd = stderr
|
||||
lea rsi, [rip + array_out_of_bounds] # message
|
||||
mov rdx, 32 # message length
|
||||
syscall
|
||||
mov rax, 60
|
||||
mov rdi, 101
|
||||
|
||||
mov rax, 60 # sys_exit
|
||||
mov rdi, 101 # exit code
|
||||
syscall
|
||||
|
||||
Reference in New Issue
Block a user