blob: b610b161cd6275d2e22abb7f39a338582bcdb274 [file] [log] [blame]
Catalin Marinas60ffc302012-03-05 11:49:27 +00001/*
2 * Low-level exception handling code
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Authors: Catalin Marinas <catalin.marinas@arm.com>
6 * Will Deacon <will.deacon@arm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <linux/init.h>
22#include <linux/linkage.h>
23
Marc Zyngier8d883b22015-06-01 10:47:41 +010024#include <asm/alternative.h>
Catalin Marinas60ffc302012-03-05 11:49:27 +000025#include <asm/assembler.h>
26#include <asm/asm-offsets.h>
Will Deacon905e8c52015-03-23 19:07:02 +000027#include <asm/cpufeature.h>
Catalin Marinas60ffc302012-03-05 11:49:27 +000028#include <asm/errno.h>
Marc Zyngier5c1ce6f2013-04-08 17:17:03 +010029#include <asm/esr.h>
James Morse8e23dac2015-12-04 11:02:27 +000030#include <asm/irq.h>
James Morsee19a6ee2016-06-20 18:28:01 +010031#include <asm/memory.h>
Catalin Marinascfa93772016-09-02 14:54:03 +010032#include <asm/ptrace.h>
Catalin Marinas60ffc302012-03-05 11:49:27 +000033#include <asm/thread_info.h>
Catalin Marinascfa93772016-09-02 14:54:03 +010034#include <asm/uaccess.h>
Kristina Martsenko9e09d902017-06-06 20:14:10 +010035#include <asm/asm-uaccess.h>
Catalin Marinas60ffc302012-03-05 11:49:27 +000036#include <asm/unistd.h>
37
38/*
Larry Bassel6c81fe72014-05-30 12:34:15 -070039 * Context tracking subsystem. Used to instrument transitions
40 * between user and kernel mode.
41 */
42 .macro ct_user_exit, syscall = 0
43#ifdef CONFIG_CONTEXT_TRACKING
44 bl context_tracking_user_exit
45 .if \syscall == 1
46 /*
47 * Save/restore needed during syscalls. Restore syscall arguments from
48 * the values already saved on stack during kernel_entry.
49 */
50 ldp x0, x1, [sp]
51 ldp x2, x3, [sp, #S_X2]
52 ldp x4, x5, [sp, #S_X4]
53 ldp x6, x7, [sp, #S_X6]
54 .endif
55#endif
56 .endm
57
58 .macro ct_user_enter
59#ifdef CONFIG_CONTEXT_TRACKING
60 bl context_tracking_user_enter
61#endif
62 .endm
63
64/*
Catalin Marinas60ffc302012-03-05 11:49:27 +000065 * Bad Abort numbers
66 *-----------------
67 */
68#define BAD_SYNC 0
69#define BAD_IRQ 1
70#define BAD_FIQ 2
71#define BAD_ERROR 3
72
Mark Rutland17d35922017-07-19 17:24:49 +010073 .macro kernel_ventry label
74 .align 7
Will Deacon63648dd2014-09-29 12:26:41 +010075 sub sp, sp, #S_FRAME_SIZE
Mark Rutland17d35922017-07-19 17:24:49 +010076 b \label
77 .endm
78
79 .macro kernel_entry, el, regsize = 64
Catalin Marinas60ffc302012-03-05 11:49:27 +000080 .if \regsize == 32
81 mov w0, w0 // zero upper 32 bits of x0
82 .endif
Will Deacon63648dd2014-09-29 12:26:41 +010083 stp x0, x1, [sp, #16 * 0]
84 stp x2, x3, [sp, #16 * 1]
85 stp x4, x5, [sp, #16 * 2]
86 stp x6, x7, [sp, #16 * 3]
87 stp x8, x9, [sp, #16 * 4]
88 stp x10, x11, [sp, #16 * 5]
89 stp x12, x13, [sp, #16 * 6]
90 stp x14, x15, [sp, #16 * 7]
91 stp x16, x17, [sp, #16 * 8]
92 stp x18, x19, [sp, #16 * 9]
93 stp x20, x21, [sp, #16 * 10]
94 stp x22, x23, [sp, #16 * 11]
95 stp x24, x25, [sp, #16 * 12]
96 stp x26, x27, [sp, #16 * 13]
97 stp x28, x29, [sp, #16 * 14]
98
Catalin Marinas60ffc302012-03-05 11:49:27 +000099 .if \el == 0
100 mrs x21, sp_el0
Jungseok Lee6cdf9c72015-12-04 11:02:25 +0000101 mov tsk, sp
102 and tsk, tsk, #~(THREAD_SIZE - 1) // Ensure MDSCR_EL1.SS is clear,
Will Deacon2a283072014-04-29 19:04:06 +0100103 ldr x19, [tsk, #TI_FLAGS] // since we can unmask debug
104 disable_step_tsk x19, x20 // exceptions when scheduling.
James Morse49003a82015-12-10 10:22:41 +0000105
106 mov x29, xzr // fp pointed to user-space
Catalin Marinas60ffc302012-03-05 11:49:27 +0000107 .else
108 add x21, sp, #S_FRAME_SIZE
James Morsee19a6ee2016-06-20 18:28:01 +0100109 get_thread_info tsk
110 /* Save the task's original addr_limit and set USER_DS (TASK_SIZE_64) */
111 ldr x20, [tsk, #TI_ADDR_LIMIT]
112 str x20, [sp, #S_ORIG_ADDR_LIMIT]
113 mov x20, #TASK_SIZE_64
114 str x20, [tsk, #TI_ADDR_LIMIT]
Vladimir Murzin563cada2016-09-01 14:35:59 +0100115 /* No need to reset PSTATE.UAO, hardware's already set it to 0 for us */
James Morsee19a6ee2016-06-20 18:28:01 +0100116 .endif /* \el == 0 */
Catalin Marinas60ffc302012-03-05 11:49:27 +0000117 mrs x22, elr_el1
118 mrs x23, spsr_el1
119 stp lr, x21, [sp, #S_LR]
Catalin Marinascfa93772016-09-02 14:54:03 +0100120
121#ifdef CONFIG_ARM64_SW_TTBR0_PAN
122 /*
123 * Set the TTBR0 PAN bit in SPSR. When the exception is taken from
124 * EL0, there is no need to check the state of TTBR0_EL1 since
125 * accesses are always enabled.
126 * Note that the meaning of this bit differs from the ARMv8.1 PAN
127 * feature as all TTBR0_EL1 accesses are disabled, not just those to
128 * user mappings.
129 */
130alternative_if ARM64_HAS_PAN
131 b 1f // skip TTBR0 PAN
132alternative_else_nop_endif
133
134 .if \el != 0
Will Deacon599c71f2017-08-10 13:58:16 +0100135 mrs x21, ttbr1_el1
Catalin Marinascfa93772016-09-02 14:54:03 +0100136 tst x21, #0xffff << 48 // Check for the reserved ASID
137 orr x23, x23, #PSR_PAN_BIT // Set the emulated PAN in the saved SPSR
138 b.eq 1f // TTBR0 access already disabled
139 and x23, x23, #~PSR_PAN_BIT // Clear the emulated PAN in the saved SPSR
140 .endif
141
142 __uaccess_ttbr0_disable x21
1431:
144#endif
145
Catalin Marinas60ffc302012-03-05 11:49:27 +0000146 stp x22, x23, [sp, #S_PC]
147
148 /*
149 * Set syscallno to -1 by default (overridden later if real syscall).
150 */
151 .if \el == 0
152 mvn x21, xzr
153 str x21, [sp, #S_SYSCALLNO]
154 .endif
155
156 /*
Jungseok Lee6cdf9c72015-12-04 11:02:25 +0000157 * Set sp_el0 to current thread_info.
158 */
159 .if \el == 0
160 msr sp_el0, tsk
161 .endif
162
163 /*
Catalin Marinas60ffc302012-03-05 11:49:27 +0000164 * Registers that may be useful after this macro is invoked:
165 *
166 * x21 - aborted SP
167 * x22 - aborted PC
168 * x23 - aborted PSTATE
169 */
170 .endm
171
Will Deacon412fcb62015-08-19 15:57:09 +0100172 .macro kernel_exit, el
James Morsee19a6ee2016-06-20 18:28:01 +0100173 .if \el != 0
174 /* Restore the task's original addr_limit. */
175 ldr x20, [sp, #S_ORIG_ADDR_LIMIT]
176 str x20, [tsk, #TI_ADDR_LIMIT]
177
178 /* No need to restore UAO, it will be restored from SPSR_EL1 */
179 .endif
180
Catalin Marinas60ffc302012-03-05 11:49:27 +0000181 ldp x21, x22, [sp, #S_PC] // load ELR, SPSR
182 .if \el == 0
Larry Bassel6c81fe72014-05-30 12:34:15 -0700183 ct_user_enter
Catalin Marinascfa93772016-09-02 14:54:03 +0100184 .endif
185
186#ifdef CONFIG_ARM64_SW_TTBR0_PAN
187 /*
188 * Restore access to TTBR0_EL1. If returning to EL0, no need for SPSR
189 * PAN bit checking.
190 */
191alternative_if ARM64_HAS_PAN
192 b 2f // skip TTBR0 PAN
193alternative_else_nop_endif
194
195 .if \el != 0
196 tbnz x22, #22, 1f // Skip re-enabling TTBR0 access if the PSR_PAN_BIT is set
197 .endif
198
Will Deacon599c71f2017-08-10 13:58:16 +0100199 __uaccess_ttbr0_enable x0, x1
Catalin Marinascfa93772016-09-02 14:54:03 +0100200
201 .if \el == 0
202 /*
203 * Enable errata workarounds only if returning to user. The only
204 * workaround currently required for TTBR0_EL1 changes are for the
205 * Cavium erratum 27456 (broadcast TLBI instructions may cause I-cache
206 * corruption).
207 */
Will Deacon071a49f2017-08-10 13:34:30 +0100208 post_ttbr_update_workaround
Catalin Marinascfa93772016-09-02 14:54:03 +0100209 .endif
2101:
211 .if \el != 0
212 and x22, x22, #~PSR_PAN_BIT // ARMv8.0 CPUs do not understand this bit
213 .endif
2142:
215#endif
216
217 .if \el == 0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000218 ldr x23, [sp, #S_SP] // load return stack pointer
Catalin Marinas60ffc302012-03-05 11:49:27 +0000219 msr sp_el0, x23
Will Deacon905e8c52015-03-23 19:07:02 +0000220#ifdef CONFIG_ARM64_ERRATUM_845719
Mark Rutland6ba3b552016-09-07 11:07:09 +0100221alternative_if ARM64_WORKAROUND_845719
Daniel Thompsone28cabf2015-07-22 12:21:03 +0100222 tbz x22, #4, 1f
223#ifdef CONFIG_PID_IN_CONTEXTIDR
224 mrs x29, contextidr_el1
225 msr contextidr_el1, x29
226#else
227 msr contextidr_el1, xzr
228#endif
2291:
Mark Rutland6ba3b552016-09-07 11:07:09 +0100230alternative_else_nop_endif
Will Deacon905e8c52015-03-23 19:07:02 +0000231#endif
Catalin Marinas60ffc302012-03-05 11:49:27 +0000232 .endif
Catalin Marinascfa93772016-09-02 14:54:03 +0100233
Will Deacon63648dd2014-09-29 12:26:41 +0100234 msr elr_el1, x21 // set up the return data
235 msr spsr_el1, x22
Will Deacon63648dd2014-09-29 12:26:41 +0100236 ldp x0, x1, [sp, #16 * 0]
Will Deacon63648dd2014-09-29 12:26:41 +0100237 ldp x2, x3, [sp, #16 * 1]
238 ldp x4, x5, [sp, #16 * 2]
239 ldp x6, x7, [sp, #16 * 3]
240 ldp x8, x9, [sp, #16 * 4]
241 ldp x10, x11, [sp, #16 * 5]
242 ldp x12, x13, [sp, #16 * 6]
243 ldp x14, x15, [sp, #16 * 7]
244 ldp x16, x17, [sp, #16 * 8]
245 ldp x18, x19, [sp, #16 * 9]
246 ldp x20, x21, [sp, #16 * 10]
247 ldp x22, x23, [sp, #16 * 11]
248 ldp x24, x25, [sp, #16 * 12]
249 ldp x26, x27, [sp, #16 * 13]
250 ldp x28, x29, [sp, #16 * 14]
251 ldr lr, [sp, #S_LR]
252 add sp, sp, #S_FRAME_SIZE // restore sp
Catalin Marinas60ffc302012-03-05 11:49:27 +0000253 eret // return to kernel
254 .endm
255
James Morse971c67c2015-12-15 11:21:25 +0000256 .macro irq_stack_entry
James Morse8e23dac2015-12-04 11:02:27 +0000257 mov x19, sp // preserve the original sp
258
James Morse8e23dac2015-12-04 11:02:27 +0000259 /*
James Morsed224a692015-12-18 16:01:47 +0000260 * Compare sp with the current thread_info, if the top
261 * ~(THREAD_SIZE - 1) bits match, we are on a task stack, and
262 * should switch to the irq stack.
James Morse8e23dac2015-12-04 11:02:27 +0000263 */
James Morsed224a692015-12-18 16:01:47 +0000264 and x25, x19, #~(THREAD_SIZE - 1)
265 cmp x25, tsk
266 b.ne 9998f
James Morse8e23dac2015-12-04 11:02:27 +0000267
James Morsed224a692015-12-18 16:01:47 +0000268 this_cpu_ptr irq_stack, x25, x26
James Morse8e23dac2015-12-04 11:02:27 +0000269 mov x26, #IRQ_STACK_START_SP
270 add x26, x25, x26
James Morsed224a692015-12-18 16:01:47 +0000271
272 /* switch to the irq stack */
James Morse8e23dac2015-12-04 11:02:27 +0000273 mov sp, x26
274
James Morse971c67c2015-12-15 11:21:25 +0000275 /*
276 * Add a dummy stack frame, this non-standard format is fixed up
277 * by unwind_frame()
278 */
279 stp x29, x19, [sp, #-16]!
James Morse8e23dac2015-12-04 11:02:27 +0000280 mov x29, sp
James Morse8e23dac2015-12-04 11:02:27 +0000281
2829998:
283 .endm
284
285 /*
286 * x19 should be preserved between irq_stack_entry and
287 * irq_stack_exit.
288 */
289 .macro irq_stack_exit
290 mov sp, x19
291 .endm
292
Catalin Marinas60ffc302012-03-05 11:49:27 +0000293/*
294 * These are the registers used in the syscall handler, and allow us to
295 * have in theory up to 7 arguments to a function - x0 to x6.
296 *
297 * x7 is reserved for the system call number in 32-bit mode.
298 */
299sc_nr .req x25 // number of system calls
300scno .req x26 // syscall number
301stbl .req x27 // syscall table pointer
302tsk .req x28 // current thread_info
303
304/*
305 * Interrupt handling.
306 */
307 .macro irq_handler
James Morse8e23dac2015-12-04 11:02:27 +0000308 ldr_l x1, handle_arch_irq
Catalin Marinas60ffc302012-03-05 11:49:27 +0000309 mov x0, sp
James Morse971c67c2015-12-15 11:21:25 +0000310 irq_stack_entry
Catalin Marinas60ffc302012-03-05 11:49:27 +0000311 blr x1
James Morse8e23dac2015-12-04 11:02:27 +0000312 irq_stack_exit
Catalin Marinas60ffc302012-03-05 11:49:27 +0000313 .endm
314
315 .text
316
317/*
318 * Exception vectors.
319 */
Pratyush Anand888b3c82016-07-08 12:35:50 -0400320 .pushsection ".entry.text", "ax"
Catalin Marinas60ffc302012-03-05 11:49:27 +0000321
322 .align 11
323ENTRY(vectors)
Mark Rutland17d35922017-07-19 17:24:49 +0100324 kernel_ventry el1_sync_invalid // Synchronous EL1t
325 kernel_ventry el1_irq_invalid // IRQ EL1t
326 kernel_ventry el1_fiq_invalid // FIQ EL1t
327 kernel_ventry el1_error_invalid // Error EL1t
Catalin Marinas60ffc302012-03-05 11:49:27 +0000328
Mark Rutland17d35922017-07-19 17:24:49 +0100329 kernel_ventry el1_sync // Synchronous EL1h
330 kernel_ventry el1_irq // IRQ EL1h
331 kernel_ventry el1_fiq_invalid // FIQ EL1h
332 kernel_ventry el1_error_invalid // Error EL1h
Catalin Marinas60ffc302012-03-05 11:49:27 +0000333
Mark Rutland17d35922017-07-19 17:24:49 +0100334 kernel_ventry el0_sync // Synchronous 64-bit EL0
335 kernel_ventry el0_irq // IRQ 64-bit EL0
336 kernel_ventry el0_fiq_invalid // FIQ 64-bit EL0
337 kernel_ventry el0_error_invalid // Error 64-bit EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000338
339#ifdef CONFIG_COMPAT
Mark Rutland17d35922017-07-19 17:24:49 +0100340 kernel_ventry el0_sync_compat // Synchronous 32-bit EL0
341 kernel_ventry el0_irq_compat // IRQ 32-bit EL0
342 kernel_ventry el0_fiq_invalid_compat // FIQ 32-bit EL0
343 kernel_ventry el0_error_invalid_compat // Error 32-bit EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000344#else
Mark Rutland17d35922017-07-19 17:24:49 +0100345 kernel_ventry el0_sync_invalid // Synchronous 32-bit EL0
346 kernel_ventry el0_irq_invalid // IRQ 32-bit EL0
347 kernel_ventry el0_fiq_invalid // FIQ 32-bit EL0
348 kernel_ventry el0_error_invalid // Error 32-bit EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000349#endif
350END(vectors)
351
352/*
353 * Invalid mode handlers
354 */
355 .macro inv_entry, el, reason, regsize = 64
Ard Biesheuvelb6609502016-03-18 10:58:09 +0100356 kernel_entry \el, \regsize
Catalin Marinas60ffc302012-03-05 11:49:27 +0000357 mov x0, sp
358 mov x1, #\reason
359 mrs x2, esr_el1
360 b bad_mode
361 .endm
362
363el0_sync_invalid:
364 inv_entry 0, BAD_SYNC
365ENDPROC(el0_sync_invalid)
366
367el0_irq_invalid:
368 inv_entry 0, BAD_IRQ
369ENDPROC(el0_irq_invalid)
370
371el0_fiq_invalid:
372 inv_entry 0, BAD_FIQ
373ENDPROC(el0_fiq_invalid)
374
375el0_error_invalid:
376 inv_entry 0, BAD_ERROR
377ENDPROC(el0_error_invalid)
378
379#ifdef CONFIG_COMPAT
380el0_fiq_invalid_compat:
381 inv_entry 0, BAD_FIQ, 32
382ENDPROC(el0_fiq_invalid_compat)
383
384el0_error_invalid_compat:
385 inv_entry 0, BAD_ERROR, 32
386ENDPROC(el0_error_invalid_compat)
387#endif
388
389el1_sync_invalid:
390 inv_entry 1, BAD_SYNC
391ENDPROC(el1_sync_invalid)
392
393el1_irq_invalid:
394 inv_entry 1, BAD_IRQ
395ENDPROC(el1_irq_invalid)
396
397el1_fiq_invalid:
398 inv_entry 1, BAD_FIQ
399ENDPROC(el1_fiq_invalid)
400
401el1_error_invalid:
402 inv_entry 1, BAD_ERROR
403ENDPROC(el1_error_invalid)
404
405/*
406 * EL1 mode handlers.
407 */
408 .align 6
409el1_sync:
410 kernel_entry 1
411 mrs x1, esr_el1 // read the syndrome register
Mark Rutlandaed40e02014-11-24 12:31:40 +0000412 lsr x24, x1, #ESR_ELx_EC_SHIFT // exception class
413 cmp x24, #ESR_ELx_EC_DABT_CUR // data abort in EL1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000414 b.eq el1_da
Laura Abbott9adeb8e2016-08-09 18:25:26 -0700415 cmp x24, #ESR_ELx_EC_IABT_CUR // instruction abort in EL1
416 b.eq el1_ia
Mark Rutlandaed40e02014-11-24 12:31:40 +0000417 cmp x24, #ESR_ELx_EC_SYS64 // configurable trap
Catalin Marinas60ffc302012-03-05 11:49:27 +0000418 b.eq el1_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000419 cmp x24, #ESR_ELx_EC_SP_ALIGN // stack alignment exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000420 b.eq el1_sp_pc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000421 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000422 b.eq el1_sp_pc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000423 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000424 b.eq el1_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000425 cmp x24, #ESR_ELx_EC_BREAKPT_CUR // debug exception in EL1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000426 b.ge el1_dbg
427 b el1_inv
Laura Abbott9adeb8e2016-08-09 18:25:26 -0700428
429el1_ia:
430 /*
431 * Fall through to the Data abort case
432 */
Catalin Marinas60ffc302012-03-05 11:49:27 +0000433el1_da:
434 /*
435 * Data abort handling
436 */
Kristina Martsenko9e09d902017-06-06 20:14:10 +0100437 mrs x3, far_el1
Will Deacon2a283072014-04-29 19:04:06 +0100438 enable_dbg
Catalin Marinas60ffc302012-03-05 11:49:27 +0000439 // re-enable interrupts if they were enabled in the aborted context
440 tbnz x23, #7, 1f // PSR_I_BIT
441 enable_irq
4421:
Kristina Martsenko9e09d902017-06-06 20:14:10 +0100443 clear_address_tag x0, x3
Catalin Marinas60ffc302012-03-05 11:49:27 +0000444 mov x2, sp // struct pt_regs
445 bl do_mem_abort
446
447 // disable interrupts before pulling preserved data off the stack
448 disable_irq
449 kernel_exit 1
450el1_sp_pc:
451 /*
452 * Stack or PC alignment exception handling
453 */
454 mrs x0, far_el1
Will Deacon2a283072014-04-29 19:04:06 +0100455 enable_dbg
Catalin Marinas60ffc302012-03-05 11:49:27 +0000456 mov x2, sp
457 b do_sp_pc_abort
458el1_undef:
459 /*
460 * Undefined instruction
461 */
Will Deacon2a283072014-04-29 19:04:06 +0100462 enable_dbg
Catalin Marinas60ffc302012-03-05 11:49:27 +0000463 mov x0, sp
464 b do_undefinstr
465el1_dbg:
466 /*
467 * Debug exception handling
468 */
Mark Rutlandaed40e02014-11-24 12:31:40 +0000469 cmp x24, #ESR_ELx_EC_BRK64 // if BRK64
Sandeepa Prabhuee6214c2013-12-04 05:50:20 +0000470 cinc x24, x24, eq // set bit '0'
Catalin Marinas60ffc302012-03-05 11:49:27 +0000471 tbz x24, #0, el1_inv // EL1 only
472 mrs x0, far_el1
473 mov x2, sp // struct pt_regs
474 bl do_debug_exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000475 kernel_exit 1
476el1_inv:
477 // TODO: add support for undefined instructions in kernel mode
Will Deacon2a283072014-04-29 19:04:06 +0100478 enable_dbg
Catalin Marinas60ffc302012-03-05 11:49:27 +0000479 mov x0, sp
Mark Rutland1b428042015-07-07 18:00:49 +0100480 mov x2, x1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000481 mov x1, #BAD_SYNC
Catalin Marinas60ffc302012-03-05 11:49:27 +0000482 b bad_mode
483ENDPROC(el1_sync)
484
485 .align 6
486el1_irq:
487 kernel_entry 1
Will Deacon2a283072014-04-29 19:04:06 +0100488 enable_dbg
Catalin Marinas60ffc302012-03-05 11:49:27 +0000489#ifdef CONFIG_TRACE_IRQFLAGS
490 bl trace_hardirqs_off
491#endif
Marc Zyngier64681782013-11-12 17:11:53 +0000492
493 irq_handler
494
Catalin Marinas60ffc302012-03-05 11:49:27 +0000495#ifdef CONFIG_PREEMPT
Neil Zhang883c0572014-01-13 08:57:56 +0000496 ldr w24, [tsk, #TI_PREEMPT] // get preempt count
Marc Zyngier717321f2013-11-04 20:14:58 +0000497 cbnz w24, 1f // preempt count != 0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000498 ldr x0, [tsk, #TI_FLAGS] // get flags
499 tbz x0, #TIF_NEED_RESCHED, 1f // needs rescheduling?
500 bl el1_preempt
5011:
502#endif
503#ifdef CONFIG_TRACE_IRQFLAGS
504 bl trace_hardirqs_on
505#endif
506 kernel_exit 1
507ENDPROC(el1_irq)
508
509#ifdef CONFIG_PREEMPT
510el1_preempt:
511 mov x24, lr
Will Deacon2a283072014-04-29 19:04:06 +01005121: bl preempt_schedule_irq // irq en/disable is done inside
Catalin Marinas60ffc302012-03-05 11:49:27 +0000513 ldr x0, [tsk, #TI_FLAGS] // get new tasks TI_FLAGS
514 tbnz x0, #TIF_NEED_RESCHED, 1b // needs rescheduling?
515 ret x24
516#endif
517
518/*
519 * EL0 mode handlers.
520 */
521 .align 6
522el0_sync:
523 kernel_entry 0
524 mrs x25, esr_el1 // read the syndrome register
Mark Rutlandaed40e02014-11-24 12:31:40 +0000525 lsr x24, x25, #ESR_ELx_EC_SHIFT // exception class
526 cmp x24, #ESR_ELx_EC_SVC64 // SVC in 64-bit state
Catalin Marinas60ffc302012-03-05 11:49:27 +0000527 b.eq el0_svc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000528 cmp x24, #ESR_ELx_EC_DABT_LOW // data abort in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000529 b.eq el0_da
Mark Rutlandaed40e02014-11-24 12:31:40 +0000530 cmp x24, #ESR_ELx_EC_IABT_LOW // instruction abort in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000531 b.eq el0_ia
Mark Rutlandaed40e02014-11-24 12:31:40 +0000532 cmp x24, #ESR_ELx_EC_FP_ASIMD // FP/ASIMD access
Catalin Marinas60ffc302012-03-05 11:49:27 +0000533 b.eq el0_fpsimd_acc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000534 cmp x24, #ESR_ELx_EC_FP_EXC64 // FP/ASIMD exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000535 b.eq el0_fpsimd_exc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000536 cmp x24, #ESR_ELx_EC_SYS64 // configurable trap
Andre Przywara7dd01ae2016-06-28 18:07:32 +0100537 b.eq el0_sys
Mark Rutlandaed40e02014-11-24 12:31:40 +0000538 cmp x24, #ESR_ELx_EC_SP_ALIGN // stack alignment exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000539 b.eq el0_sp_pc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000540 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000541 b.eq el0_sp_pc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000542 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000543 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000544 cmp x24, #ESR_ELx_EC_BREAKPT_LOW // debug exception in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000545 b.ge el0_dbg
546 b el0_inv
547
548#ifdef CONFIG_COMPAT
549 .align 6
550el0_sync_compat:
551 kernel_entry 0, 32
552 mrs x25, esr_el1 // read the syndrome register
Mark Rutlandaed40e02014-11-24 12:31:40 +0000553 lsr x24, x25, #ESR_ELx_EC_SHIFT // exception class
554 cmp x24, #ESR_ELx_EC_SVC32 // SVC in 32-bit state
Catalin Marinas60ffc302012-03-05 11:49:27 +0000555 b.eq el0_svc_compat
Mark Rutlandaed40e02014-11-24 12:31:40 +0000556 cmp x24, #ESR_ELx_EC_DABT_LOW // data abort in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000557 b.eq el0_da
Mark Rutlandaed40e02014-11-24 12:31:40 +0000558 cmp x24, #ESR_ELx_EC_IABT_LOW // instruction abort in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000559 b.eq el0_ia
Mark Rutlandaed40e02014-11-24 12:31:40 +0000560 cmp x24, #ESR_ELx_EC_FP_ASIMD // FP/ASIMD access
Catalin Marinas60ffc302012-03-05 11:49:27 +0000561 b.eq el0_fpsimd_acc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000562 cmp x24, #ESR_ELx_EC_FP_EXC32 // FP/ASIMD exception
Catalin Marinas60ffc302012-03-05 11:49:27 +0000563 b.eq el0_fpsimd_exc
Mark Salyzyn77f3228f2015-10-13 14:30:51 -0700564 cmp x24, #ESR_ELx_EC_PC_ALIGN // pc alignment exception
565 b.eq el0_sp_pc
Mark Rutlandaed40e02014-11-24 12:31:40 +0000566 cmp x24, #ESR_ELx_EC_UNKNOWN // unknown exception in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000567 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000568 cmp x24, #ESR_ELx_EC_CP15_32 // CP15 MRC/MCR trap
Mark Rutland381cc2b2013-05-24 12:02:35 +0100569 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000570 cmp x24, #ESR_ELx_EC_CP15_64 // CP15 MRRC/MCRR trap
Mark Rutland381cc2b2013-05-24 12:02:35 +0100571 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000572 cmp x24, #ESR_ELx_EC_CP14_MR // CP14 MRC/MCR trap
Mark Rutland381cc2b2013-05-24 12:02:35 +0100573 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000574 cmp x24, #ESR_ELx_EC_CP14_LS // CP14 LDC/STC trap
Mark Rutland381cc2b2013-05-24 12:02:35 +0100575 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000576 cmp x24, #ESR_ELx_EC_CP14_64 // CP14 MRRC/MCRR trap
Mark Rutland381cc2b2013-05-24 12:02:35 +0100577 b.eq el0_undef
Mark Rutlandaed40e02014-11-24 12:31:40 +0000578 cmp x24, #ESR_ELx_EC_BREAKPT_LOW // debug exception in EL0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000579 b.ge el0_dbg
580 b el0_inv
581el0_svc_compat:
582 /*
583 * AArch32 syscall handling
584 */
Catalin Marinas01564112015-01-06 16:42:32 +0000585 adrp stbl, compat_sys_call_table // load compat syscall table pointer
Catalin Marinas60ffc302012-03-05 11:49:27 +0000586 uxtw scno, w7 // syscall number in w7 (r7)
587 mov sc_nr, #__NR_compat_syscalls
588 b el0_svc_naked
589
590 .align 6
591el0_irq_compat:
592 kernel_entry 0, 32
593 b el0_irq_naked
594#endif
595
596el0_da:
597 /*
598 * Data abort handling
599 */
Larry Bassel6ab64632014-05-30 20:34:14 +0100600 mrs x26, far_el1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000601 // enable interrupts before calling the main handler
Will Deacon2a283072014-04-29 19:04:06 +0100602 enable_dbg_and_irq
Larry Bassel6c81fe72014-05-30 12:34:15 -0700603 ct_user_exit
Kristina Martsenko9e09d902017-06-06 20:14:10 +0100604 clear_address_tag x0, x26
Catalin Marinas60ffc302012-03-05 11:49:27 +0000605 mov x1, x25
606 mov x2, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100607 bl do_mem_abort
608 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000609el0_ia:
610 /*
611 * Instruction abort handling
612 */
Larry Bassel6ab64632014-05-30 20:34:14 +0100613 mrs x26, far_el1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000614 // enable interrupts before calling the main handler
Will Deacon2a283072014-04-29 19:04:06 +0100615 enable_dbg_and_irq
Larry Bassel6c81fe72014-05-30 12:34:15 -0700616 ct_user_exit
Larry Bassel6ab64632014-05-30 20:34:14 +0100617 mov x0, x26
Mark Rutland541ec872016-05-31 12:33:03 +0100618 mov x1, x25
Catalin Marinas60ffc302012-03-05 11:49:27 +0000619 mov x2, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100620 bl do_mem_abort
621 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000622el0_fpsimd_acc:
623 /*
624 * Floating Point or Advanced SIMD access
625 */
Will Deacon2a283072014-04-29 19:04:06 +0100626 enable_dbg
Larry Bassel6c81fe72014-05-30 12:34:15 -0700627 ct_user_exit
Catalin Marinas60ffc302012-03-05 11:49:27 +0000628 mov x0, x25
629 mov x1, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100630 bl do_fpsimd_acc
631 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000632el0_fpsimd_exc:
633 /*
634 * Floating Point or Advanced SIMD exception
635 */
Will Deacon2a283072014-04-29 19:04:06 +0100636 enable_dbg
Larry Bassel6c81fe72014-05-30 12:34:15 -0700637 ct_user_exit
Catalin Marinas60ffc302012-03-05 11:49:27 +0000638 mov x0, x25
639 mov x1, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100640 bl do_fpsimd_exc
641 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000642el0_sp_pc:
643 /*
644 * Stack or PC alignment exception handling
645 */
Larry Bassel6ab64632014-05-30 20:34:14 +0100646 mrs x26, far_el1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000647 // enable interrupts before calling the main handler
Will Deacon2a283072014-04-29 19:04:06 +0100648 enable_dbg_and_irq
Mark Rutland46b05672015-06-15 16:40:27 +0100649 ct_user_exit
Larry Bassel6ab64632014-05-30 20:34:14 +0100650 mov x0, x26
Catalin Marinas60ffc302012-03-05 11:49:27 +0000651 mov x1, x25
652 mov x2, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100653 bl do_sp_pc_abort
654 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000655el0_undef:
656 /*
657 * Undefined instruction
658 */
Catalin Marinas2600e132013-08-22 11:47:37 +0100659 // enable interrupts before calling the main handler
Will Deacon2a283072014-04-29 19:04:06 +0100660 enable_dbg_and_irq
Larry Bassel6c81fe72014-05-30 12:34:15 -0700661 ct_user_exit
Will Deacon2a283072014-04-29 19:04:06 +0100662 mov x0, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100663 bl do_undefinstr
664 b ret_to_user
Andre Przywara7dd01ae2016-06-28 18:07:32 +0100665el0_sys:
666 /*
667 * System instructions, for trapped cache maintenance instructions
668 */
669 enable_dbg_and_irq
670 ct_user_exit
671 mov x0, x25
672 mov x1, sp
673 bl do_sysinstr
674 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000675el0_dbg:
676 /*
677 * Debug exception handling
678 */
679 tbnz x24, #0, el0_inv // EL0 only
680 mrs x0, far_el1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000681 mov x1, x25
682 mov x2, sp
Will Deacon2a283072014-04-29 19:04:06 +0100683 bl do_debug_exception
684 enable_dbg
Larry Bassel6c81fe72014-05-30 12:34:15 -0700685 ct_user_exit
Will Deacon2a283072014-04-29 19:04:06 +0100686 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000687el0_inv:
Will Deacon2a283072014-04-29 19:04:06 +0100688 enable_dbg
Larry Bassel6c81fe72014-05-30 12:34:15 -0700689 ct_user_exit
Catalin Marinas60ffc302012-03-05 11:49:27 +0000690 mov x0, sp
691 mov x1, #BAD_SYNC
Mark Rutland1b428042015-07-07 18:00:49 +0100692 mov x2, x25
Mark Rutlandde327942017-01-18 17:23:41 +0000693 bl bad_el0_sync
Will Deacond54e81f2014-09-29 11:44:01 +0100694 b ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000695ENDPROC(el0_sync)
696
697 .align 6
698el0_irq:
699 kernel_entry 0
700el0_irq_naked:
Catalin Marinas60ffc302012-03-05 11:49:27 +0000701 enable_dbg
702#ifdef CONFIG_TRACE_IRQFLAGS
703 bl trace_hardirqs_off
704#endif
Marc Zyngier64681782013-11-12 17:11:53 +0000705
Larry Bassel6c81fe72014-05-30 12:34:15 -0700706 ct_user_exit
Catalin Marinas60ffc302012-03-05 11:49:27 +0000707 irq_handler
Marc Zyngier64681782013-11-12 17:11:53 +0000708
Catalin Marinas60ffc302012-03-05 11:49:27 +0000709#ifdef CONFIG_TRACE_IRQFLAGS
710 bl trace_hardirqs_on
711#endif
712 b ret_to_user
713ENDPROC(el0_irq)
714
715/*
Catalin Marinas60ffc302012-03-05 11:49:27 +0000716 * Register switch for AArch64. The callee-saved registers need to be saved
717 * and restored. On entry:
718 * x0 = previous task_struct (must be preserved across the switch)
719 * x1 = next task_struct
720 * Previous and next are guaranteed not to be the same.
721 *
722 */
723ENTRY(cpu_switch_to)
Will Deaconc0d3fce2015-07-20 15:14:53 +0100724 mov x10, #THREAD_CPU_CONTEXT
725 add x8, x0, x10
Catalin Marinas60ffc302012-03-05 11:49:27 +0000726 mov x9, sp
727 stp x19, x20, [x8], #16 // store callee-saved registers
728 stp x21, x22, [x8], #16
729 stp x23, x24, [x8], #16
730 stp x25, x26, [x8], #16
731 stp x27, x28, [x8], #16
732 stp x29, x9, [x8], #16
733 str lr, [x8]
Will Deaconc0d3fce2015-07-20 15:14:53 +0100734 add x8, x1, x10
Catalin Marinas60ffc302012-03-05 11:49:27 +0000735 ldp x19, x20, [x8], #16 // restore callee-saved registers
736 ldp x21, x22, [x8], #16
737 ldp x23, x24, [x8], #16
738 ldp x25, x26, [x8], #16
739 ldp x27, x28, [x8], #16
740 ldp x29, x9, [x8], #16
741 ldr lr, [x8]
742 mov sp, x9
Jungseok Lee6cdf9c72015-12-04 11:02:25 +0000743 and x9, x9, #~(THREAD_SIZE - 1)
744 msr sp_el0, x9
Catalin Marinas60ffc302012-03-05 11:49:27 +0000745 ret
746ENDPROC(cpu_switch_to)
747
748/*
749 * This is the fast syscall return path. We do as little as possible here,
750 * and this includes saving x0 back into the kernel stack.
751 */
752ret_fast_syscall:
753 disable_irq // disable interrupts
Will Deacon412fcb62015-08-19 15:57:09 +0100754 str x0, [sp, #S_X0] // returned x0
Josh Stone04d7e092015-06-05 14:28:03 -0700755 ldr x1, [tsk, #TI_FLAGS] // re-check for syscall tracing
756 and x2, x1, #_TIF_SYSCALL_WORK
757 cbnz x2, ret_fast_syscall_trace
Catalin Marinas60ffc302012-03-05 11:49:27 +0000758 and x2, x1, #_TIF_WORK_MASK
Will Deacon412fcb62015-08-19 15:57:09 +0100759 cbnz x2, work_pending
Will Deacon2a283072014-04-29 19:04:06 +0100760 enable_step_tsk x1, x2
Will Deacon412fcb62015-08-19 15:57:09 +0100761 kernel_exit 0
Josh Stone04d7e092015-06-05 14:28:03 -0700762ret_fast_syscall_trace:
763 enable_irq // enable interrupts
Will Deacon412fcb62015-08-19 15:57:09 +0100764 b __sys_trace_return_skipped // we already saved x0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000765
766/*
767 * Ok, we need to do extra processing, enter the slow path.
768 */
Catalin Marinas60ffc302012-03-05 11:49:27 +0000769work_pending:
Catalin Marinas60ffc302012-03-05 11:49:27 +0000770 mov x0, sp // 'regs'
Catalin Marinas60ffc302012-03-05 11:49:27 +0000771 bl do_notify_resume
Catalin Marinasdb3899a2015-12-04 12:42:29 +0000772#ifdef CONFIG_TRACE_IRQFLAGS
Chris Metcalf421dd6f2016-07-14 16:48:14 -0400773 bl trace_hardirqs_on // enabled while in userspace
Catalin Marinasdb3899a2015-12-04 12:42:29 +0000774#endif
Chris Metcalf421dd6f2016-07-14 16:48:14 -0400775 ldr x1, [tsk, #TI_FLAGS] // re-check for single-step
776 b finish_ret_to_user
Catalin Marinas60ffc302012-03-05 11:49:27 +0000777/*
778 * "slow" syscall return path.
779 */
Catalin Marinas59dc67b2012-09-10 16:11:46 +0100780ret_to_user:
Catalin Marinas60ffc302012-03-05 11:49:27 +0000781 disable_irq // disable interrupts
782 ldr x1, [tsk, #TI_FLAGS]
783 and x2, x1, #_TIF_WORK_MASK
784 cbnz x2, work_pending
Chris Metcalf421dd6f2016-07-14 16:48:14 -0400785finish_ret_to_user:
Will Deacon2a283072014-04-29 19:04:06 +0100786 enable_step_tsk x1, x2
Will Deacon412fcb62015-08-19 15:57:09 +0100787 kernel_exit 0
Catalin Marinas60ffc302012-03-05 11:49:27 +0000788ENDPROC(ret_to_user)
789
790/*
791 * This is how we return from a fork.
792 */
793ENTRY(ret_from_fork)
794 bl schedule_tail
Catalin Marinasc34501d2012-10-05 12:31:20 +0100795 cbz x19, 1f // not a kernel thread
796 mov x0, x20
797 blr x19
7981: get_thread_info tsk
Catalin Marinas60ffc302012-03-05 11:49:27 +0000799 b ret_to_user
800ENDPROC(ret_from_fork)
801
802/*
803 * SVC handler.
804 */
805 .align 6
806el0_svc:
807 adrp stbl, sys_call_table // load syscall table pointer
808 uxtw scno, w8 // syscall number in w8
809 mov sc_nr, #__NR_syscalls
810el0_svc_naked: // compat entry point
811 stp x0, scno, [sp, #S_ORIG_X0] // save the original x0 and syscall number
Will Deacon2a283072014-04-29 19:04:06 +0100812 enable_dbg_and_irq
Larry Bassel6c81fe72014-05-30 12:34:15 -0700813 ct_user_exit 1
Catalin Marinas60ffc302012-03-05 11:49:27 +0000814
AKASHI Takahiro449f81a2014-04-30 10:51:29 +0100815 ldr x16, [tsk, #TI_FLAGS] // check for syscall hooks
816 tst x16, #_TIF_SYSCALL_WORK
817 b.ne __sys_trace
Catalin Marinas60ffc302012-03-05 11:49:27 +0000818 cmp scno, sc_nr // check upper syscall limit
819 b.hs ni_sys
820 ldr x16, [stbl, scno, lsl #3] // address in the syscall table
Will Deacond54e81f2014-09-29 11:44:01 +0100821 blr x16 // call sys_* routine
822 b ret_fast_syscall
Catalin Marinas60ffc302012-03-05 11:49:27 +0000823ni_sys:
824 mov x0, sp
Will Deacond54e81f2014-09-29 11:44:01 +0100825 bl do_ni_syscall
826 b ret_fast_syscall
Catalin Marinas60ffc302012-03-05 11:49:27 +0000827ENDPROC(el0_svc)
828
829 /*
830 * This is the really slow path. We're going to be doing context
831 * switches, and waiting for our parent to respond.
832 */
833__sys_trace:
AKASHI Takahiro1014c812014-11-28 05:26:35 +0000834 mov w0, #-1 // set default errno for
835 cmp scno, x0 // user-issued syscall(-1)
836 b.ne 1f
837 mov x0, #-ENOSYS
838 str x0, [sp, #S_X0]
8391: mov x0, sp
AKASHI Takahiro31578582014-04-30 10:51:30 +0100840 bl syscall_trace_enter
AKASHI Takahiro1014c812014-11-28 05:26:35 +0000841 cmp w0, #-1 // skip the syscall?
842 b.eq __sys_trace_return_skipped
Catalin Marinas60ffc302012-03-05 11:49:27 +0000843 uxtw scno, w0 // syscall number (possibly new)
844 mov x1, sp // pointer to regs
845 cmp scno, sc_nr // check upper syscall limit
Will Deacond54e81f2014-09-29 11:44:01 +0100846 b.hs __ni_sys_trace
Catalin Marinas60ffc302012-03-05 11:49:27 +0000847 ldp x0, x1, [sp] // restore the syscall args
848 ldp x2, x3, [sp, #S_X2]
849 ldp x4, x5, [sp, #S_X4]
850 ldp x6, x7, [sp, #S_X6]
851 ldr x16, [stbl, scno, lsl #3] // address in the syscall table
Will Deacond54e81f2014-09-29 11:44:01 +0100852 blr x16 // call sys_* routine
Catalin Marinas60ffc302012-03-05 11:49:27 +0000853
854__sys_trace_return:
AKASHI Takahiro1014c812014-11-28 05:26:35 +0000855 str x0, [sp, #S_X0] // save returned x0
856__sys_trace_return_skipped:
AKASHI Takahiro31578582014-04-30 10:51:30 +0100857 mov x0, sp
858 bl syscall_trace_exit
Catalin Marinas60ffc302012-03-05 11:49:27 +0000859 b ret_to_user
860
Will Deacond54e81f2014-09-29 11:44:01 +0100861__ni_sys_trace:
862 mov x0, sp
863 bl do_ni_syscall
864 b __sys_trace_return
865
Pratyush Anand888b3c82016-07-08 12:35:50 -0400866 .popsection // .entry.text
867
Catalin Marinas60ffc302012-03-05 11:49:27 +0000868/*
869 * Special system call wrappers.
870 */
Catalin Marinas60ffc302012-03-05 11:49:27 +0000871ENTRY(sys_rt_sigreturn_wrapper)
872 mov x0, sp
873 b sys_rt_sigreturn
874ENDPROC(sys_rt_sigreturn_wrapper)