I am trying to call the nanosleep syscall in assembly on the mac m1 architecture, but when I run it, I get an unexpected error. Link to the C code I try to get working in assembly. I have changed bl nanosleep
with
mov x16, 0x65
svc 0x80
Where 0x65
is the syscall for nanosleep according to this
mov x0, 2
str x0, [sp, 56]
str xzr, [sp, 48]
ldr x0, [sp, 56]
str x0, [sp, 24]
ldr x0, [sp, 48]
str x0, [sp, 32]
add x0, sp, 24
mov x1, 0
mov x16, 0x65
svc 0x80
Error
terminated by signal SIGSYS (Bad system call)