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

Fear1ess committed
5
.global wd_syscall_aarch64
Fear1ess committed
6 7
.extern wd_set_errno

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

Fear1ess committed
10
wd_syscall_aarch64:
Fear1ess committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
     /* 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