xref: /aosp_15_r20/system/core/debuggerd/crasher/arm64/crashglue.S (revision 00c7fec1bb09f3284aad6a6f96d2f63dfc3650ad)
1/*
2 * Copyright 2013, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17.globl crash1
18.type crash1, %function
19crash1:
20	.cfi_startproc
21	stp x29, x30, [sp, -16]!
22	.cfi_def_cfa_offset 16
23	.cfi_rel_offset x29, 0
24	.cfi_rel_offset x30, 8
25	ldr x0, =0xa5a50000
26	ldr x1, =0xa5a50001
27	ldr x2, =0xa5a50002
28	ldr x3, =0xa5a50003
29	ldr x4, =0xa5a50004
30	ldr x5, =0xa5a50005
31	ldr x6, =0xa5a50006
32	ldr x7, =0xa5a50007
33	ldr x8, =0xa5a50008
34	ldr x9, =0xa5a50009
35	ldr x10, =0xa5a50010
36	ldr x11, =0xa5a50011
37	ldr x12, =0xa5a50012
38	ldr x13, =0xa5a50013
39	ldr x14, =0xa5a50014
40	ldr x15, =0xa5a50015
41	ldr x16, =0xa5a50016
42	ldr x17, =0xa5a50017
43	ldr x18, =0xa5a50018
44	ldr x19, =0xa5a50019
45	ldr x20, =0xa5a50020
46	ldr x21, =0xa5a50021
47	ldr x22, =0xa5a50022
48	ldr x23, =0xa5a50023
49	ldr x24, =0xa5a50024
50	ldr x25, =0xa5a50025
51	ldr x26, =0xa5a50026
52	ldr x27, =0xa5a50027
53	ldr x28, =0xa5a50028
54	ldr x29, =0xa5a50029
55
56	mov x30, xzr
57	ldr x30, [x30]
58	b .
59	.cfi_endproc
60	.size crash1, .-crash1
61
62
63.globl crash_no_stack
64.type crash_no_stack, %function
65crash_no_stack:
66	.cfi_startproc
67	mov x1, sp
68	.cfi_def_cfa_register x1
69	mov x0, xzr
70	add sp, x0, xzr
71	ldr x0, [x0]
72	b .
73	.cfi_endproc
74	.size crash_no_stack, .-crash_no_stack
75
76
77.globl crash_bti
78.type crash_bti, %function
79crash_bti:
80	.cfi_startproc
81	adr x16, 1f
82	br x16
831:	// Deliberatly not a bti instruction so we crash here.
84	b .
85	.cfi_endproc
86	.size crash_bti, .-crash_bti
87
88
89.globl crash_pac
90.type crash_pac, %function
91crash_pac:
92	.cfi_startproc
93	paciasp
94	// Since sp is a pac input, this ensures a mismatch.
95	sub sp, sp, #16
96	autiasp
97	b .
98	.cfi_endproc
99	.size crash_pac, .-crash_pac
100
101// Set the PAC and BTI bits for this object file.
102.section .note.gnu.property, "a"
103.balign 8
104.long 4
105.long 0x10
106.long 0x5
107.asciz "GNU"
108.long 0xc0000000
109.long 4
110.long 0x3
111.long 0
112