]> git.saurik.com Git - apple/xnu.git/blob - san/kasan-test-arm64.s
xnu-4903.270.47.tar.gz
[apple/xnu.git] / san / kasan-test-arm64.s
1 #include <arm64/proc_reg.h>
2 #include <mach/arm64/asm.h>
3 #include <architecture/arm/asm_help.h>
4
5 #define JMP_r19_20 #0x00
6 #define JMP_r21_22 #0x10
7 #define JMP_r23_24 #0x20
8 #define JMP_r25_26 #0x30
9 #define JMP_r27_28 #0x40
10 #define JMP_r29_lr #0x50
11 #define JMP_fp_sp #0x60
12
13 #define JMP_d8_d9 #0x70
14 #define JMP_d10_d11 #0x80
15 #define JMP_d12_d13 #0x90
16 #define JMP_d14_d15 #0xA0
17
18 .text
19
20 .align 5
21 .globl EXT(_setjmp)
22 LEXT(_setjmp)
23 add x1, sp, #0 /* can't STP from sp */
24 stp x19, x20, [x0, JMP_r19_20]
25 stp x21, x22, [x0, JMP_r21_22]
26 stp x23, x24, [x0, JMP_r23_24]
27 stp x25, x26, [x0, JMP_r25_26]
28 stp x27, x28, [x0, JMP_r27_28]
29 stp x29, lr, [x0, JMP_r29_lr]
30 stp fp, x1, [x0, JMP_fp_sp]
31 stp d8, d9, [x0, JMP_d8_d9]
32 stp d10, d11, [x0, JMP_d10_d11]
33 stp d12, d13, [x0, JMP_d12_d13]
34 stp d14, d15, [x0, JMP_d14_d15]
35 mov x0, #0
36 ret
37
38 .align 5
39 .globl EXT(_longjmp)
40 LEXT(_longjmp)
41 ldp x19, x20, [x0, JMP_r19_20]
42 ldp x21, x22, [x0, JMP_r21_22]
43 ldp x23, x24, [x0, JMP_r23_24]
44 ldp x25, x26, [x0, JMP_r25_26]
45 ldp x27, x28, [x0, JMP_r27_28]
46 ldp x29, lr, [x0, JMP_r29_lr]
47 ldp fp, x2, [x0, JMP_fp_sp]
48 ldp d8, d9, [x0, JMP_d8_d9]
49 ldp d10, d11, [x0, JMP_d10_d11]
50 ldp d12, d13, [x0, JMP_d12_d13]
51 ldp d14, d15, [x0, JMP_d14_d15]
52 add sp, x2, #0
53 mov x0, x1
54 cmp x0, #0 /* longjmp returns 1 if val is 0 */
55 b.ne 1f
56 add x0, x0, #1
57 1: ret
58