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