wd_syscall64.s 555 Bytes
Newer Older
Fear1ess committed
1 2 3 4
//
// Created by Fear1ess on 2021/3/31.
//

Fear1ess committed
5 6 7
.global wd_syscall64
.extern wd_set_errno

1256748979@qq.com committed
8 9
.type wd_syscall64, %function

Fear1ess committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
wd_syscall64:
     /* Move syscall No. from x0 to x8 */
     sub     x0, x0, #0xcd
     mov     x8, x0
     /* Move syscall parameters from x1 thru x6 to x0 thru x5 */
     mov     x0, x1
     mov     x1, x2
     mov     x2, x3
     mov     x3, x4
     mov     x4, x5
     mov     x5, x6
     svc     #0
     /* check if syscall returned successfully */
     cmn     x0, #0x1000
     cneg    x0, x0, hi
     b.hi    wd_set_errno
     ret