Merge branch 'v3.10/topic/misc' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / kernel / entry.S
1 /*
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
24 #include <asm/assembler.h>
25 #include <asm/asm-offsets.h>
26 #include <asm/errno.h>
27 #include <asm/esr.h>
28 #include <asm/thread_info.h>
29 #include <asm/unistd.h>
30 #include <asm/unistd32.h>
31
32 /*
33  * Bad Abort numbers
34  *-----------------
35  */
36 #define BAD_SYNC        0
37 #define BAD_IRQ         1
38 #define BAD_FIQ         2
39 #define BAD_ERROR       3
40
41         .macro  kernel_entry, el, regsize = 64
42         sub     sp, sp, #S_FRAME_SIZE - S_LR    // room for LR, SP, SPSR, ELR
43         .if     \regsize == 32
44         mov     w0, w0                          // zero upper 32 bits of x0
45         .endif
46         push    x28, x29
47         push    x26, x27
48         push    x24, x25
49         push    x22, x23
50         push    x20, x21
51         push    x18, x19
52         push    x16, x17
53         push    x14, x15
54         push    x12, x13
55         push    x10, x11
56         push    x8, x9
57         push    x6, x7
58         push    x4, x5
59         push    x2, x3
60         push    x0, x1
61         .if     \el == 0
62         mrs     x21, sp_el0
63         .else
64         add     x21, sp, #S_FRAME_SIZE
65         .endif
66         mrs     x22, elr_el1
67         mrs     x23, spsr_el1
68         stp     lr, x21, [sp, #S_LR]
69         stp     x22, x23, [sp, #S_PC]
70
71         /*
72          * Set syscallno to -1 by default (overridden later if real syscall).
73          */
74         .if     \el == 0
75         mvn     x21, xzr
76         str     x21, [sp, #S_SYSCALLNO]
77         .endif
78
79         /*
80          * Registers that may be useful after this macro is invoked:
81          *
82          * x21 - aborted SP
83          * x22 - aborted PC
84          * x23 - aborted PSTATE
85         */
86         .endm
87
88         .macro  kernel_exit, el, ret = 0
89         ldp     x21, x22, [sp, #S_PC]           // load ELR, SPSR
90         .if     \el == 0
91         ldr     x23, [sp, #S_SP]                // load return stack pointer
92         .endif
93         .if     \ret
94         ldr     x1, [sp, #S_X1]                 // preserve x0 (syscall return)
95         add     sp, sp, S_X2
96         .else
97         pop     x0, x1
98         .endif
99         pop     x2, x3                          // load the rest of the registers
100         pop     x4, x5
101         pop     x6, x7
102         pop     x8, x9
103         msr     elr_el1, x21                    // set up the return data
104         msr     spsr_el1, x22
105         .if     \el == 0
106         msr     sp_el0, x23
107         .endif
108         pop     x10, x11
109         pop     x12, x13
110         pop     x14, x15
111         pop     x16, x17
112         pop     x18, x19
113         pop     x20, x21
114         pop     x22, x23
115         pop     x24, x25
116         pop     x26, x27
117         pop     x28, x29
118         ldr     lr, [sp], #S_FRAME_SIZE - S_LR  // load LR and restore SP
119         eret                                    // return to kernel
120         .endm
121
122         .macro  get_thread_info, rd
123         mov     \rd, sp
124         and     \rd, \rd, #~(THREAD_SIZE - 1)   // top of stack
125         .endm
126
127 /*
128  * These are the registers used in the syscall handler, and allow us to
129  * have in theory up to 7 arguments to a function - x0 to x6.
130  *
131  * x7 is reserved for the system call number in 32-bit mode.
132  */
133 sc_nr   .req    x25             // number of system calls
134 scno    .req    x26             // syscall number
135 stbl    .req    x27             // syscall table pointer
136 tsk     .req    x28             // current thread_info
137
138 /*
139  * Interrupt handling.
140  */
141         .macro  irq_handler
142         ldr     x1, handle_arch_irq
143         mov     x0, sp
144         blr     x1
145         .endm
146
147         .text
148
149 /*
150  * Exception vectors.
151  */
152
153         .align  11
154 ENTRY(vectors)
155         ventry  el1_sync_invalid                // Synchronous EL1t
156         ventry  el1_irq_invalid                 // IRQ EL1t
157         ventry  el1_fiq_invalid                 // FIQ EL1t
158         ventry  el1_error_invalid               // Error EL1t
159
160         ventry  el1_sync                        // Synchronous EL1h
161         ventry  el1_irq                         // IRQ EL1h
162         ventry  el1_fiq_invalid                 // FIQ EL1h
163         ventry  el1_error_invalid               // Error EL1h
164
165         ventry  el0_sync                        // Synchronous 64-bit EL0
166         ventry  el0_irq                         // IRQ 64-bit EL0
167         ventry  el0_fiq_invalid                 // FIQ 64-bit EL0
168         ventry  el0_error_invalid               // Error 64-bit EL0
169
170 #ifdef CONFIG_COMPAT
171         ventry  el0_sync_compat                 // Synchronous 32-bit EL0
172         ventry  el0_irq_compat                  // IRQ 32-bit EL0
173         ventry  el0_fiq_invalid_compat          // FIQ 32-bit EL0
174         ventry  el0_error_invalid_compat        // Error 32-bit EL0
175 #else
176         ventry  el0_sync_invalid                // Synchronous 32-bit EL0
177         ventry  el0_irq_invalid                 // IRQ 32-bit EL0
178         ventry  el0_fiq_invalid                 // FIQ 32-bit EL0
179         ventry  el0_error_invalid               // Error 32-bit EL0
180 #endif
181 END(vectors)
182
183 /*
184  * Invalid mode handlers
185  */
186         .macro  inv_entry, el, reason, regsize = 64
187         kernel_entry el, \regsize
188         mov     x0, sp
189         mov     x1, #\reason
190         mrs     x2, esr_el1
191         b       bad_mode
192         .endm
193
194 el0_sync_invalid:
195         inv_entry 0, BAD_SYNC
196 ENDPROC(el0_sync_invalid)
197
198 el0_irq_invalid:
199         inv_entry 0, BAD_IRQ
200 ENDPROC(el0_irq_invalid)
201
202 el0_fiq_invalid:
203         inv_entry 0, BAD_FIQ
204 ENDPROC(el0_fiq_invalid)
205
206 el0_error_invalid:
207         inv_entry 0, BAD_ERROR
208 ENDPROC(el0_error_invalid)
209
210 #ifdef CONFIG_COMPAT
211 el0_fiq_invalid_compat:
212         inv_entry 0, BAD_FIQ, 32
213 ENDPROC(el0_fiq_invalid_compat)
214
215 el0_error_invalid_compat:
216         inv_entry 0, BAD_ERROR, 32
217 ENDPROC(el0_error_invalid_compat)
218 #endif
219
220 el1_sync_invalid:
221         inv_entry 1, BAD_SYNC
222 ENDPROC(el1_sync_invalid)
223
224 el1_irq_invalid:
225         inv_entry 1, BAD_IRQ
226 ENDPROC(el1_irq_invalid)
227
228 el1_fiq_invalid:
229         inv_entry 1, BAD_FIQ
230 ENDPROC(el1_fiq_invalid)
231
232 el1_error_invalid:
233         inv_entry 1, BAD_ERROR
234 ENDPROC(el1_error_invalid)
235
236 /*
237  * EL1 mode handlers.
238  */
239         .align  6
240 el1_sync:
241         kernel_entry 1
242         mrs     x1, esr_el1                     // read the syndrome register
243         lsr     x24, x1, #ESR_EL1_EC_SHIFT      // exception class
244         cmp     x24, #ESR_EL1_EC_DABT_EL1       // data abort in EL1
245         b.eq    el1_da
246         cmp     x24, #ESR_EL1_EC_SYS64          // configurable trap
247         b.eq    el1_undef
248         cmp     x24, #ESR_EL1_EC_SP_ALIGN       // stack alignment exception
249         b.eq    el1_sp_pc
250         cmp     x24, #ESR_EL1_EC_PC_ALIGN       // pc alignment exception
251         b.eq    el1_sp_pc
252         cmp     x24, #ESR_EL1_EC_UNKNOWN        // unknown exception in EL1
253         b.eq    el1_undef
254         cmp     x24, #ESR_EL1_EC_BREAKPT_EL1    // debug exception in EL1
255         b.ge    el1_dbg
256         b       el1_inv
257 el1_da:
258         /*
259          * Data abort handling
260          */
261         mrs     x0, far_el1
262         enable_dbg_if_not_stepping x2
263         // re-enable interrupts if they were enabled in the aborted context
264         tbnz    x23, #7, 1f                     // PSR_I_BIT
265         enable_irq
266 1:
267         mov     x2, sp                          // struct pt_regs
268         bl      do_mem_abort
269
270         // disable interrupts before pulling preserved data off the stack
271         disable_irq
272         kernel_exit 1
273 el1_sp_pc:
274         /*
275          * Stack or PC alignment exception handling
276          */
277         mrs     x0, far_el1
278         mov     x2, sp
279         b       do_sp_pc_abort
280 el1_undef:
281         /*
282          * Undefined instruction
283          */
284         mov     x0, sp
285         b       do_undefinstr
286 el1_dbg:
287         /*
288          * Debug exception handling
289          */
290         cmp     x24, #ESR_EL1_EC_BRK64          // if BRK64
291         cinc    x24, x24, eq                    // set bit '0'
292         tbz     x24, #0, el1_inv                // EL1 only
293         mrs     x0, far_el1
294         mov     x2, sp                          // struct pt_regs
295         bl      do_debug_exception
296
297         kernel_exit 1
298 el1_inv:
299         // TODO: add support for undefined instructions in kernel mode
300         mov     x0, sp
301         mov     x1, #BAD_SYNC
302         mrs     x2, esr_el1
303         b       bad_mode
304 ENDPROC(el1_sync)
305
306         .align  6
307 el1_irq:
308         kernel_entry 1
309         enable_dbg_if_not_stepping x0
310 #ifdef CONFIG_TRACE_IRQFLAGS
311         bl      trace_hardirqs_off
312 #endif
313 #ifdef CONFIG_PREEMPT
314         get_thread_info tsk
315         ldr     w24, [tsk, #TI_PREEMPT]         // get preempt count
316         add     w0, w24, #1                     // increment it
317         str     w0, [tsk, #TI_PREEMPT]
318 #endif
319         irq_handler
320 #ifdef CONFIG_PREEMPT
321         str     w24, [tsk, #TI_PREEMPT]         // restore preempt count
322         cbnz    w24, 1f                         // preempt count != 0
323         ldr     x0, [tsk, #TI_FLAGS]            // get flags
324         tbz     x0, #TIF_NEED_RESCHED, 1f       // needs rescheduling?
325         bl      el1_preempt
326 1:
327 #endif
328 #ifdef CONFIG_TRACE_IRQFLAGS
329         bl      trace_hardirqs_on
330 #endif
331         kernel_exit 1
332 ENDPROC(el1_irq)
333
334 #ifdef CONFIG_PREEMPT
335 el1_preempt:
336         mov     x24, lr
337 1:      enable_dbg
338         bl      preempt_schedule_irq            // irq en/disable is done inside
339         ldr     x0, [tsk, #TI_FLAGS]            // get new tasks TI_FLAGS
340         tbnz    x0, #TIF_NEED_RESCHED, 1b       // needs rescheduling?
341         ret     x24
342 #endif
343
344 /*
345  * EL0 mode handlers.
346  */
347         .align  6
348 el0_sync:
349         kernel_entry 0
350         mrs     x25, esr_el1                    // read the syndrome register
351         lsr     x24, x25, #ESR_EL1_EC_SHIFT     // exception class
352         cmp     x24, #ESR_EL1_EC_SVC64          // SVC in 64-bit state
353         b.eq    el0_svc
354         adr     lr, ret_from_exception
355         cmp     x24, #ESR_EL1_EC_DABT_EL0       // data abort in EL0
356         b.eq    el0_da
357         cmp     x24, #ESR_EL1_EC_IABT_EL0       // instruction abort in EL0
358         b.eq    el0_ia
359         cmp     x24, #ESR_EL1_EC_FP_ASIMD       // FP/ASIMD access
360         b.eq    el0_fpsimd_acc
361         cmp     x24, #ESR_EL1_EC_FP_EXC64       // FP/ASIMD exception
362         b.eq    el0_fpsimd_exc
363         cmp     x24, #ESR_EL1_EC_SYS64          // configurable trap
364         b.eq    el0_undef
365         cmp     x24, #ESR_EL1_EC_SP_ALIGN       // stack alignment exception
366         b.eq    el0_sp_pc
367         cmp     x24, #ESR_EL1_EC_PC_ALIGN       // pc alignment exception
368         b.eq    el0_sp_pc
369         cmp     x24, #ESR_EL1_EC_UNKNOWN        // unknown exception in EL0
370         b.eq    el0_undef
371         cmp     x24, #ESR_EL1_EC_BREAKPT_EL0    // debug exception in EL0
372         b.ge    el0_dbg
373         b       el0_inv
374
375 #ifdef CONFIG_COMPAT
376         .align  6
377 el0_sync_compat:
378         kernel_entry 0, 32
379         mrs     x25, esr_el1                    // read the syndrome register
380         lsr     x24, x25, #ESR_EL1_EC_SHIFT     // exception class
381         cmp     x24, #ESR_EL1_EC_SVC32          // SVC in 32-bit state
382         b.eq    el0_svc_compat
383         adr     lr, ret_from_exception
384         cmp     x24, #ESR_EL1_EC_DABT_EL0       // data abort in EL0
385         b.eq    el0_da
386         cmp     x24, #ESR_EL1_EC_IABT_EL0       // instruction abort in EL0
387         b.eq    el0_ia
388         cmp     x24, #ESR_EL1_EC_FP_ASIMD       // FP/ASIMD access
389         b.eq    el0_fpsimd_acc
390         cmp     x24, #ESR_EL1_EC_FP_EXC32       // FP/ASIMD exception
391         b.eq    el0_fpsimd_exc
392         cmp     x24, #ESR_EL1_EC_UNKNOWN        // unknown exception in EL0
393         b.eq    el0_undef
394         cmp     x24, #ESR_EL1_EC_CP15_32        // CP15 MRC/MCR trap
395         b.eq    el0_undef
396         cmp     x24, #ESR_EL1_EC_CP15_64        // CP15 MRRC/MCRR trap
397         b.eq    el0_undef
398         cmp     x24, #ESR_EL1_EC_CP14_MR        // CP14 MRC/MCR trap
399         b.eq    el0_undef
400         cmp     x24, #ESR_EL1_EC_CP14_LS        // CP14 LDC/STC trap
401         b.eq    el0_undef
402         cmp     x24, #ESR_EL1_EC_CP14_64        // CP14 MRRC/MCRR trap
403         b.eq    el0_undef
404         cmp     x24, #ESR_EL1_EC_BREAKPT_EL0    // debug exception in EL0
405         b.ge    el0_dbg
406         b       el0_inv
407 el0_svc_compat:
408         /*
409          * AArch32 syscall handling
410          */
411         adr     stbl, compat_sys_call_table     // load compat syscall table pointer
412         uxtw    scno, w7                        // syscall number in w7 (r7)
413         mov     sc_nr, #__NR_compat_syscalls
414         b       el0_svc_naked
415
416         .align  6
417 el0_irq_compat:
418         kernel_entry 0, 32
419         b       el0_irq_naked
420 #endif
421
422 el0_da:
423         /*
424          * Data abort handling
425          */
426         mrs     x0, far_el1
427         bic     x0, x0, #(0xff << 56)
428         disable_step x1
429         isb
430         enable_dbg
431         // enable interrupts before calling the main handler
432         enable_irq
433         mov     x1, x25
434         mov     x2, sp
435         b       do_mem_abort
436 el0_ia:
437         /*
438          * Instruction abort handling
439          */
440         mrs     x0, far_el1
441         disable_step x1
442         isb
443         enable_dbg
444         // enable interrupts before calling the main handler
445         enable_irq
446         orr     x1, x25, #1 << 24               // use reserved ISS bit for instruction aborts
447         mov     x2, sp
448         b       do_mem_abort
449 el0_fpsimd_acc:
450         /*
451          * Floating Point or Advanced SIMD access
452          */
453         mov     x0, x25
454         mov     x1, sp
455         b       do_fpsimd_acc
456 el0_fpsimd_exc:
457         /*
458          * Floating Point or Advanced SIMD exception
459          */
460         mov     x0, x25
461         mov     x1, sp
462         b       do_fpsimd_exc
463 el0_sp_pc:
464         /*
465          * Stack or PC alignment exception handling
466          */
467         mrs     x0, far_el1
468         disable_step x1
469         isb
470         enable_dbg
471         // enable interrupts before calling the main handler
472         enable_irq
473         mov     x1, x25
474         mov     x2, sp
475         b       do_sp_pc_abort
476 el0_undef:
477         /*
478          * Undefined instruction
479          */
480         mov     x0, sp
481         // enable interrupts before calling the main handler
482         enable_irq
483         b       do_undefinstr
484 el0_dbg:
485         /*
486          * Debug exception handling
487          */
488         tbnz    x24, #0, el0_inv                // EL0 only
489         mrs     x0, far_el1
490         disable_step x1
491         mov     x1, x25
492         mov     x2, sp
493         b       do_debug_exception
494 el0_inv:
495         mov     x0, sp
496         mov     x1, #BAD_SYNC
497         mrs     x2, esr_el1
498         b       bad_mode
499 ENDPROC(el0_sync)
500
501         .align  6
502 el0_irq:
503         kernel_entry 0
504 el0_irq_naked:
505         disable_step x1
506         isb
507         enable_dbg
508 #ifdef CONFIG_TRACE_IRQFLAGS
509         bl      trace_hardirqs_off
510 #endif
511         get_thread_info tsk
512 #ifdef CONFIG_PREEMPT
513         ldr     w24, [tsk, #TI_PREEMPT]         // get preempt count
514         add     w23, w24, #1                    // increment it
515         str     w23, [tsk, #TI_PREEMPT]
516 #endif
517         irq_handler
518 #ifdef CONFIG_PREEMPT
519         ldr     w0, [tsk, #TI_PREEMPT]
520         str     w24, [tsk, #TI_PREEMPT]
521         cmp     w0, w23
522         b.eq    1f
523         mov     x1, #0
524         str     x1, [x1]                        // BUG
525 1:
526 #endif
527 #ifdef CONFIG_TRACE_IRQFLAGS
528         bl      trace_hardirqs_on
529 #endif
530         b       ret_to_user
531 ENDPROC(el0_irq)
532
533 /*
534  * This is the return code to user mode for abort handlers
535  */
536 ret_from_exception:
537         get_thread_info tsk
538         b       ret_to_user
539 ENDPROC(ret_from_exception)
540
541 /*
542  * Register switch for AArch64. The callee-saved registers need to be saved
543  * and restored. On entry:
544  *   x0 = previous task_struct (must be preserved across the switch)
545  *   x1 = next task_struct
546  * Previous and next are guaranteed not to be the same.
547  *
548  */
549 ENTRY(cpu_switch_to)
550         add     x8, x0, #THREAD_CPU_CONTEXT
551         mov     x9, sp
552         stp     x19, x20, [x8], #16             // store callee-saved registers
553         stp     x21, x22, [x8], #16
554         stp     x23, x24, [x8], #16
555         stp     x25, x26, [x8], #16
556         stp     x27, x28, [x8], #16
557         stp     x29, x9, [x8], #16
558         str     lr, [x8]
559         add     x8, x1, #THREAD_CPU_CONTEXT
560         ldp     x19, x20, [x8], #16             // restore callee-saved registers
561         ldp     x21, x22, [x8], #16
562         ldp     x23, x24, [x8], #16
563         ldp     x25, x26, [x8], #16
564         ldp     x27, x28, [x8], #16
565         ldp     x29, x9, [x8], #16
566         ldr     lr, [x8]
567         mov     sp, x9
568         ret
569 ENDPROC(cpu_switch_to)
570
571 /*
572  * This is the fast syscall return path.  We do as little as possible here,
573  * and this includes saving x0 back into the kernel stack.
574  */
575 ret_fast_syscall:
576         disable_irq                             // disable interrupts
577         ldr     x1, [tsk, #TI_FLAGS]
578         and     x2, x1, #_TIF_WORK_MASK
579         cbnz    x2, fast_work_pending
580         tbz     x1, #TIF_SINGLESTEP, fast_exit
581         disable_dbg
582         enable_step x2
583 fast_exit:
584         kernel_exit 0, ret = 1
585
586 /*
587  * Ok, we need to do extra processing, enter the slow path.
588  */
589 fast_work_pending:
590         str     x0, [sp, #S_X0]                 // returned x0
591 work_pending:
592         tbnz    x1, #TIF_NEED_RESCHED, work_resched
593         /* TIF_SIGPENDING or TIF_NOTIFY_RESUME case */
594         ldr     x2, [sp, #S_PSTATE]
595         mov     x0, sp                          // 'regs'
596         tst     x2, #PSR_MODE_MASK              // user mode regs?
597         b.ne    no_work_pending                 // returning to kernel
598         enable_irq                              // enable interrupts for do_notify_resume()
599         bl      do_notify_resume
600         b       ret_to_user
601 work_resched:
602         enable_dbg
603         bl      schedule
604
605 /*
606  * "slow" syscall return path.
607  */
608 ret_to_user:
609         disable_irq                             // disable interrupts
610         ldr     x1, [tsk, #TI_FLAGS]
611         and     x2, x1, #_TIF_WORK_MASK
612         cbnz    x2, work_pending
613         tbz     x1, #TIF_SINGLESTEP, no_work_pending
614         disable_dbg
615         enable_step x2
616 no_work_pending:
617         kernel_exit 0, ret = 0
618 ENDPROC(ret_to_user)
619
620 /*
621  * This is how we return from a fork.
622  */
623 ENTRY(ret_from_fork)
624         bl      schedule_tail
625         cbz     x19, 1f                         // not a kernel thread
626         mov     x0, x20
627         blr     x19
628 1:      get_thread_info tsk
629         b       ret_to_user
630 ENDPROC(ret_from_fork)
631
632 /*
633  * SVC handler.
634  */
635         .align  6
636 el0_svc:
637         adrp    stbl, sys_call_table            // load syscall table pointer
638         uxtw    scno, w8                        // syscall number in w8
639         mov     sc_nr, #__NR_syscalls
640 el0_svc_naked:                                  // compat entry point
641         stp     x0, scno, [sp, #S_ORIG_X0]      // save the original x0 and syscall number
642         disable_step x16
643         isb
644         enable_dbg
645         enable_irq
646
647         get_thread_info tsk
648         ldr     x16, [tsk, #TI_FLAGS]           // check for syscall hooks
649         tst     x16, #_TIF_SYSCALL_WORK
650         b.ne    __sys_trace
651         adr     lr, ret_fast_syscall            // return address
652         cmp     scno, sc_nr                     // check upper syscall limit
653         b.hs    ni_sys
654         ldr     x16, [stbl, scno, lsl #3]       // address in the syscall table
655         br      x16                             // call sys_* routine
656 ni_sys:
657         mov     x0, sp
658         b       do_ni_syscall
659 ENDPROC(el0_svc)
660
661         /*
662          * This is the really slow path.  We're going to be doing context
663          * switches, and waiting for our parent to respond.
664          */
665 __sys_trace:
666         mov     x0, sp
667         bl      syscall_trace_enter
668         adr     lr, __sys_trace_return          // return address
669         uxtw    scno, w0                        // syscall number (possibly new)
670         mov     x1, sp                          // pointer to regs
671         cmp     scno, sc_nr                     // check upper syscall limit
672         b.hs    ni_sys
673         ldp     x0, x1, [sp]                    // restore the syscall args
674         ldp     x2, x3, [sp, #S_X2]
675         ldp     x4, x5, [sp, #S_X4]
676         ldp     x6, x7, [sp, #S_X6]
677         ldr     x16, [stbl, scno, lsl #3]       // address in the syscall table
678         br      x16                             // call sys_* routine
679
680 __sys_trace_return:
681         str     x0, [sp]                        // save returned x0
682         mov     x0, sp
683         bl      syscall_trace_exit
684         b       ret_to_user
685
686 /*
687  * Special system call wrappers.
688  */
689 ENTRY(sys_rt_sigreturn_wrapper)
690         mov     x0, sp
691         b       sys_rt_sigreturn
692 ENDPROC(sys_rt_sigreturn_wrapper)
693
694 ENTRY(handle_arch_irq)
695         .quad   0