1d2912cb1SThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */ 21da177e4SLinus Torvalds/* 31da177e4SLinus Torvalds * linux/arch/arm/kernel/entry-common.S 41da177e4SLinus Torvalds * 51da177e4SLinus Torvalds * Copyright (C) 2000 Russell King 61da177e4SLinus Torvalds */ 71da177e4SLinus Torvalds 86ebbf2ceSRussell King#include <asm/assembler.h> 91da177e4SLinus Torvalds#include <asm/unistd.h> 10395a59d0SAbhishek Sagar#include <asm/ftrace.h> 11c4c5716eSCatalin Marinas#include <asm/unwind.h> 12a9ff6961SLinus Walleij#include <asm/page.h> 1396a8fae0SRussell King#ifdef CONFIG_AEABI 1496a8fae0SRussell King#include <asm/unistd-oabi.h> 1596a8fae0SRussell King#endif 1696a8fae0SRussell King 1796a8fae0SRussell King .equ NR_syscalls, __NR_syscalls 181da177e4SLinus Torvalds 191da177e4SLinus Torvalds#include "entry-header.S" 201da177e4SLinus Torvalds 21309ee042SRussell Kingsaved_psr .req r8 2224a9c541SFrederic Weisbecker#if defined(CONFIG_TRACE_IRQFLAGS) || defined(CONFIG_CONTEXT_TRACKING_USER) 23fcea4523SRussell Kingsaved_pc .req r9 24fcea4523SRussell King#define TRACE(x...) x 25fcea4523SRussell King#else 26309ee042SRussell Kingsaved_pc .req lr 27fcea4523SRussell King#define TRACE(x...) 28fcea4523SRussell King#endif 291da177e4SLinus Torvalds 30c6089061SRussell King .section .entry.text,"ax",%progbits 311da177e4SLinus Torvalds .align 5 3224a9c541SFrederic Weisbecker#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING_USER) || \ 33b74406f3SMathieu Desnoyers IS_ENABLED(CONFIG_DEBUG_RSEQ)) 341da177e4SLinus Torvalds/* 353302caddSRussell King * This is the fast syscall return path. We do as little as possible here, 363302caddSRussell King * such as avoiding writing r0 to the stack. We only use this path if we 37b74406f3SMathieu Desnoyers * have tracing, context tracking and rseq debug disabled - the overheads 38b74406f3SMathieu Desnoyers * from those features make this path too inefficient. 391da177e4SLinus Torvalds */ 401da177e4SLinus Torvaldsret_fast_syscall: 41afc9f65eSVincent Whitchurch__ret_fast_syscall: 42c4c5716eSCatalin Marinas UNWIND(.fnstart ) 43c4c5716eSCatalin Marinas UNWIND(.cantunwind ) 443302caddSRussell King disable_irq_notrace @ disable interrupts 451b979372SRussell King ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing 4632d59773SJens Axboe movs r1, r1, lsl #16 471da177e4SLinus Torvalds bne fast_work_pending 48f4dc9a4cSRussell King 49b86040a5SCatalin Marinas restore_user_regs fast = 1, offset = S_OFF 50c4c5716eSCatalin Marinas UNWIND(.fnend ) 513302caddSRussell KingENDPROC(ret_fast_syscall) 521da177e4SLinus Torvalds 533302caddSRussell King /* Ok, we need to do extra processing, enter the slow path. */ 541da177e4SLinus Torvaldsfast_work_pending: 551da177e4SLinus Torvalds str r0, [sp, #S_R0+S_OFF]! @ returned r0 563302caddSRussell King /* fall through to work_pending */ 573302caddSRussell King#else 583302caddSRussell King/* 59b74406f3SMathieu Desnoyers * The "replacement" ret_fast_syscall for when tracing, context tracking, 60b74406f3SMathieu Desnoyers * or rseq debug is enabled. As we will need to call out to some C functions, 61b74406f3SMathieu Desnoyers * we save r0 first to avoid needing to save registers around each C function 62b74406f3SMathieu Desnoyers * call. 633302caddSRussell King */ 643302caddSRussell Kingret_fast_syscall: 65afc9f65eSVincent Whitchurch__ret_fast_syscall: 663302caddSRussell King UNWIND(.fnstart ) 673302caddSRussell King UNWIND(.cantunwind ) 683302caddSRussell King str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 69b74406f3SMathieu Desnoyers#if IS_ENABLED(CONFIG_DEBUG_RSEQ) 70b74406f3SMathieu Desnoyers /* do_rseq_syscall needs interrupts enabled. */ 71b74406f3SMathieu Desnoyers mov r0, sp @ 'regs' 72b74406f3SMathieu Desnoyers bl do_rseq_syscall 73b74406f3SMathieu Desnoyers#endif 743302caddSRussell King disable_irq_notrace @ disable interrupts 753302caddSRussell King ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing 7632d59773SJens Axboe movs r1, r1, lsl #16 773302caddSRussell King beq no_work_pending 783302caddSRussell King UNWIND(.fnend ) 793302caddSRussell KingENDPROC(ret_fast_syscall) 803302caddSRussell King 813302caddSRussell King /* Slower path - fall through to work_pending */ 823302caddSRussell King#endif 833302caddSRussell King 843302caddSRussell King tst r1, #_TIF_SYSCALL_WORK 853302caddSRussell King bne __sys_trace_return_nosave 863302caddSRussell Kingslow_work_pending: 871da177e4SLinus Torvalds mov r0, sp @ 'regs' 881da177e4SLinus Torvalds mov r2, why @ 'syscall' 890a267fa6SAl Viro bl do_work_pending 9066285217SAl Viro cmp r0, #0 9181783786SAl Viro beq no_work_pending 9266285217SAl Viro movlt scno, #(__NR_restart_syscall - __NR_SYSCALL_BASE) 93*cf007647SKees Cook str scno, [tsk, #TI_ABI_SYSCALL] @ make sure tracers see update 9481783786SAl Viro ldmia sp, {r0 - r6} @ have to reload r0 - r6 9581783786SAl Viro b local_restart @ ... and off we go 96e83dd377SDrew RichardsonENDPROC(ret_fast_syscall) 9781783786SAl Viro 981da177e4SLinus Torvalds/* 991da177e4SLinus Torvalds * "slow" syscall return path. "why" tells us if this was a real syscall. 1003302caddSRussell King * IRQs may be enabled here, so always disable them. Note that we use the 1013302caddSRussell King * "notrace" version to avoid calling into the tracing code unnecessarily. 1023302caddSRussell King * do_work_pending() will update this state if necessary. 1031da177e4SLinus Torvalds */ 1041da177e4SLinus TorvaldsENTRY(ret_to_user) 1051da177e4SLinus Torvaldsret_slow_syscall: 106b74406f3SMathieu Desnoyers#if IS_ENABLED(CONFIG_DEBUG_RSEQ) 107b74406f3SMathieu Desnoyers /* do_rseq_syscall needs interrupts enabled. */ 108b74406f3SMathieu Desnoyers enable_irq_notrace @ enable interrupts 109b74406f3SMathieu Desnoyers mov r0, sp @ 'regs' 110b74406f3SMathieu Desnoyers bl do_rseq_syscall 111b74406f3SMathieu Desnoyers#endif 1123302caddSRussell King disable_irq_notrace @ disable interrupts 1139fc2552aSMing LeiENTRY(ret_to_user_from_irq) 1141da177e4SLinus Torvalds ldr r1, [tsk, #TI_FLAGS] 11532d59773SJens Axboe movs r1, r1, lsl #16 1163302caddSRussell King bne slow_work_pending 1171da177e4SLinus Torvaldsno_work_pending: 1183302caddSRussell King asm_trace_hardirqs_on save = 0 119651e9499SRussell King 120b0088480SKevin Hilman ct_user_enter save = 0 121f80dff9dSDan Williams 122b86040a5SCatalin Marinas restore_user_regs fast = 0, offset = 0 1239fc2552aSMing LeiENDPROC(ret_to_user_from_irq) 12493ed3970SCatalin MarinasENDPROC(ret_to_user) 1251da177e4SLinus Torvalds 1261da177e4SLinus Torvalds/* 1271da177e4SLinus Torvalds * This is how we return from a fork. 1281da177e4SLinus Torvalds */ 1291da177e4SLinus TorvaldsENTRY(ret_from_fork) 1301da177e4SLinus Torvalds bl schedule_tail 1319fff2fa0SAl Viro cmp r5, #0 1329fff2fa0SAl Viro movne r0, r4 13314327c66SRussell King badrne lr, 1f 1346ebbf2ceSRussell King retne r5 13568687c84SRussell King1: get_thread_info tsk 1361da177e4SLinus Torvalds b ret_slow_syscall 13793ed3970SCatalin MarinasENDPROC(ret_from_fork) 1381da177e4SLinus Torvalds 1391da177e4SLinus Torvalds/*============================================================================= 1401da177e4SLinus Torvalds * SWI handler 1411da177e4SLinus Torvalds *----------------------------------------------------------------------------- 1421da177e4SLinus Torvalds */ 1431da177e4SLinus Torvalds 1441da177e4SLinus Torvalds .align 5 145b9baf5c8SRussell King (Oracle)#ifdef CONFIG_HARDEN_BRANCH_HISTORY 146b9baf5c8SRussell King (Oracle)ENTRY(vector_bhb_loop8_swi) 147b9baf5c8SRussell King (Oracle) sub sp, sp, #PT_REGS_SIZE 148b9baf5c8SRussell King (Oracle) stmia sp, {r0 - r12} 149b9baf5c8SRussell King (Oracle) mov r8, #8 150b9baf5c8SRussell King (Oracle)1: b 2f 151b9baf5c8SRussell King (Oracle)2: subs r8, r8, #1 152b9baf5c8SRussell King (Oracle) bne 1b 153892c608aSArd Biesheuvel dsb nsh 154b9baf5c8SRussell King (Oracle) isb 155b9baf5c8SRussell King (Oracle) b 3f 156b9baf5c8SRussell King (Oracle)ENDPROC(vector_bhb_loop8_swi) 157b9baf5c8SRussell King (Oracle) 158b9baf5c8SRussell King (Oracle) .align 5 159b9baf5c8SRussell King (Oracle)ENTRY(vector_bhb_bpiall_swi) 160b9baf5c8SRussell King (Oracle) sub sp, sp, #PT_REGS_SIZE 161b9baf5c8SRussell King (Oracle) stmia sp, {r0 - r12} 162b9baf5c8SRussell King (Oracle) mcr p15, 0, r8, c7, c5, 6 @ BPIALL 163b9baf5c8SRussell King (Oracle) isb 164b9baf5c8SRussell King (Oracle) b 3f 165b9baf5c8SRussell King (Oracle)ENDPROC(vector_bhb_bpiall_swi) 166b9baf5c8SRussell King (Oracle)#endif 167b9baf5c8SRussell King (Oracle) .align 5 1681da177e4SLinus TorvaldsENTRY(vector_swi) 16919c4d593SUwe Kleine-König#ifdef CONFIG_CPU_V7M 17019c4d593SUwe Kleine-König v7m_exception_entry 17119c4d593SUwe Kleine-König#else 1725745eef6SRussell King sub sp, sp, #PT_REGS_SIZE 173f4dc9a4cSRussell King stmia sp, {r0 - r12} @ Calling r0 - r12 174b9baf5c8SRussell King (Oracle)3: 175b86040a5SCatalin Marinas ARM( add r8, sp, #S_PC ) 176b86040a5SCatalin Marinas ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr 177b86040a5SCatalin Marinas THUMB( mov r8, sp ) 178b86040a5SCatalin Marinas THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr 179309ee042SRussell King mrs saved_psr, spsr @ called from non-FIQ mode, so ok. 180fcea4523SRussell King TRACE( mov saved_pc, lr ) 181309ee042SRussell King str saved_pc, [sp, #S_PC] @ Save calling PC 182309ee042SRussell King str saved_psr, [sp, #S_PSR] @ Save CPSR 183f4dc9a4cSRussell King str r0, [sp, #S_OLD_R0] @ Save OLD_R0 18419c4d593SUwe Kleine-König#endif 18550596b75SArd Biesheuvel reload_current r10, ip 1861da177e4SLinus Torvalds zero_fp 18750807460SArd Biesheuvel alignment_trap r10, ip, cr_alignment 188dca778c5SRussell King asm_trace_hardirqs_on save=0 189dca778c5SRussell King enable_irq_notrace 190dca778c5SRussell King ct_user_exit save=0 1911aa2b3b7SWill Deacon 192e0f9f4a6SRussell King /* 193e0f9f4a6SRussell King * Get the system call number. 194e0f9f4a6SRussell King */ 1953f2829a3SNicolas Pitre 196dd35afc2SNicolas Pitre#if defined(CONFIG_OABI_COMPAT) 1973f2829a3SNicolas Pitre 198dd35afc2SNicolas Pitre /* 199dd35afc2SNicolas Pitre * If we have CONFIG_OABI_COMPAT then we need to look at the swi 200dd35afc2SNicolas Pitre * value to determine if it is an EABI or an old ABI call. 201dd35afc2SNicolas Pitre */ 202dd35afc2SNicolas Pitre#ifdef CONFIG_ARM_THUMB 203309ee042SRussell King tst saved_psr, #PSR_T_BIT 204dd35afc2SNicolas Pitre movne r10, #0 @ no thumb OABI emulation 205309ee042SRussell King USER( ldreq r10, [saved_pc, #-4] ) @ get SWI instruction 206dd35afc2SNicolas Pitre#else 207309ee042SRussell King USER( ldr r10, [saved_pc, #-4] ) @ get SWI instruction 208dd35afc2SNicolas Pitre#endif 209457c2403SBen Dooks ARM_BE8(rev r10, r10) @ little endian instruction 210dd35afc2SNicolas Pitre 211dd35afc2SNicolas Pitre#elif defined(CONFIG_AEABI) 212dd35afc2SNicolas Pitre 213dd35afc2SNicolas Pitre /* 214dd35afc2SNicolas Pitre * Pure EABI user space always put syscall number into scno (r7). 215dd35afc2SNicolas Pitre */ 2163f2829a3SNicolas Pitre#elif defined(CONFIG_ARM_THUMB) 217dd35afc2SNicolas Pitre /* Legacy ABI only, possibly thumb mode. */ 218309ee042SRussell King tst saved_psr, #PSR_T_BIT @ this is SPSR from save_user_regs 219e0f9f4a6SRussell King addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in 220309ee042SRussell King USER( ldreq scno, [saved_pc, #-4] ) 221dd35afc2SNicolas Pitre 222e0f9f4a6SRussell King#else 223dd35afc2SNicolas Pitre /* Legacy ABI only. */ 224309ee042SRussell King USER( ldr scno, [saved_pc, #-4] ) @ get SWI instruction 225e0f9f4a6SRussell King#endif 2261da177e4SLinus Torvalds 227309ee042SRussell King /* saved_psr and saved_pc are now dead */ 228309ee042SRussell King 2292190fed6SRussell King uaccess_disable tbl 2304e57a4ddSArnd Bergmann get_thread_info tsk 2312190fed6SRussell King 232dd35afc2SNicolas Pitre adr tbl, sys_call_table @ load syscall table pointer 233dd35afc2SNicolas Pitre 234dd35afc2SNicolas Pitre#if defined(CONFIG_OABI_COMPAT) 235dd35afc2SNicolas Pitre /* 236dd35afc2SNicolas Pitre * If the swi argument is zero, this is an EABI call and we do nothing. 237dd35afc2SNicolas Pitre * 238dd35afc2SNicolas Pitre * If this is an old ABI call, get the syscall number into scno and 239dd35afc2SNicolas Pitre * get the old ABI syscall table address. 240dd35afc2SNicolas Pitre */ 241dd35afc2SNicolas Pitre bics r10, r10, #0xff000000 2424e57a4ddSArnd Bergmann strne r10, [tsk, #TI_ABI_SYSCALL] 2434e57a4ddSArnd Bergmann streq scno, [tsk, #TI_ABI_SYSCALL] 244dd35afc2SNicolas Pitre eorne scno, r10, #__NR_OABI_SYSCALL_BASE 245dd35afc2SNicolas Pitre ldrne tbl, =sys_oabi_call_table 246dd35afc2SNicolas Pitre#elif !defined(CONFIG_AEABI) 2471da177e4SLinus Torvalds bic scno, scno, #0xff000000 @ mask off SWI op-code 2484e57a4ddSArnd Bergmann str scno, [tsk, #TI_ABI_SYSCALL] 249e0f9f4a6SRussell King eor scno, scno, #__NR_SYSCALL_BASE @ check OS number 2504e57a4ddSArnd Bergmann#else 2514e57a4ddSArnd Bergmann str scno, [tsk, #TI_ABI_SYSCALL] 2523f2829a3SNicolas Pitre#endif 253dca778c5SRussell King /* 254dca778c5SRussell King * Reload the registers that may have been corrupted on entry to 255dca778c5SRussell King * the syscall assembly (by tracing or context tracking.) 256dca778c5SRussell King */ 257dca778c5SRussell King TRACE( ldmia sp, {r0 - r3} ) 258dd35afc2SNicolas Pitre 25981783786SAl Virolocal_restart: 26070c70d97SNicolas Pitre ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing 2613f2829a3SNicolas Pitre stmdb sp!, {r4, r5} @ push fifth and sixth args 26270c70d97SNicolas Pitre 26329ef73b7SNathaniel Husted tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? 2641da177e4SLinus Torvalds bne __sys_trace 2651da177e4SLinus Torvalds 266afc9f65eSVincent Whitchurch invoke_syscall tbl, scno, r10, __ret_fast_syscall 2671da177e4SLinus Torvalds 2681da177e4SLinus Torvalds add r1, sp, #S_OFF 269d95bc250SWill Deacon2: cmp scno, #(__ARM_NR_BASE - __NR_SYSCALL_BASE) 270e0f9f4a6SRussell King eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back 2711da177e4SLinus Torvalds bcs arm_syscall 272d95bc250SWill Deacon mov why, #0 @ no longer a real syscall 2731da177e4SLinus Torvalds b sys_ni_syscall @ not private func 2741aa2b3b7SWill Deacon 2751aa2b3b7SWill Deacon#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI) 2761aa2b3b7SWill Deacon /* 2771aa2b3b7SWill Deacon * We failed to handle a fault trying to access the page 2781aa2b3b7SWill Deacon * containing the swi instruction, but we're not really in a 2791aa2b3b7SWill Deacon * position to return -EFAULT. Instead, return back to the 2801aa2b3b7SWill Deacon * instruction and re-enter the user fault handling path trying 2811aa2b3b7SWill Deacon * to page it in. This will likely result in sending SEGV to the 2821aa2b3b7SWill Deacon * current task. 2831aa2b3b7SWill Deacon */ 2841aa2b3b7SWill Deacon9001: 285309ee042SRussell King sub lr, saved_pc, #4 2861aa2b3b7SWill Deacon str lr, [sp, #S_PC] 287da594e3fSRussell King get_thread_info tsk 2881aa2b3b7SWill Deacon b ret_fast_syscall 2891aa2b3b7SWill Deacon#endif 29093ed3970SCatalin MarinasENDPROC(vector_swi) 29129589ca0SArd Biesheuvel .ltorg 2921da177e4SLinus Torvalds 2931da177e4SLinus Torvalds /* 2941da177e4SLinus Torvalds * This is the really slow path. We're going to be doing 2951da177e4SLinus Torvalds * context switches, and waiting for our parent to respond. 2961da177e4SLinus Torvalds */ 2971da177e4SLinus Torvalds__sys_trace: 298ad722541SWill Deacon add r0, sp, #S_OFF 299ad722541SWill Deacon bl syscall_trace_enter 30010573ae5SRussell King mov scno, r0 30110573ae5SRussell King invoke_syscall tbl, scno, r10, __sys_trace_return, reload=1 302ad75b514SKees Cook cmp scno, #-1 @ skip the syscall? 303ad75b514SKees Cook bne 2b 304ad75b514SKees Cook add sp, sp, #S_OFF @ restore stack 3051da177e4SLinus Torvalds 306f18aef74STimothy E Baldwin__sys_trace_return_nosave: 307f18aef74STimothy E Baldwin enable_irq_notrace 308ad722541SWill Deacon mov r0, sp 309ad722541SWill Deacon bl syscall_trace_exit 3101da177e4SLinus Torvalds b ret_slow_syscall 3111da177e4SLinus Torvalds 312f18aef74STimothy E Baldwin__sys_trace_return: 313f18aef74STimothy E Baldwin str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 3143302caddSRussell King mov r0, sp 3153302caddSRussell King bl syscall_trace_exit 3163302caddSRussell King b ret_slow_syscall 3173302caddSRussell King 31896a8fae0SRussell King .macro syscall_table_start, sym 31996a8fae0SRussell King .equ __sys_nr, 0 32096a8fae0SRussell King .type \sym, #object 32196a8fae0SRussell KingENTRY(\sym) 32296a8fae0SRussell King .endm 32396a8fae0SRussell King 32496a8fae0SRussell King .macro syscall, nr, func 32596a8fae0SRussell King .ifgt __sys_nr - \nr 32696a8fae0SRussell King .error "Duplicated/unorded system call entry" 32796a8fae0SRussell King .endif 32896a8fae0SRussell King .rept \nr - __sys_nr 32996a8fae0SRussell King .long sys_ni_syscall 33096a8fae0SRussell King .endr 33196a8fae0SRussell King .long \func 33296a8fae0SRussell King .equ __sys_nr, \nr + 1 33396a8fae0SRussell King .endm 33496a8fae0SRussell King 33596a8fae0SRussell King .macro syscall_table_end, sym 33696a8fae0SRussell King .ifgt __sys_nr - __NR_syscalls 33796a8fae0SRussell King .error "System call table too big" 33896a8fae0SRussell King .endif 33996a8fae0SRussell King .rept __NR_syscalls - __sys_nr 34096a8fae0SRussell King .long sys_ni_syscall 34196a8fae0SRussell King .endr 34296a8fae0SRussell King .size \sym, . - \sym 34396a8fae0SRussell King .endm 34496a8fae0SRussell King 3450047eb9fSMasahiro Yamada#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) 3460047eb9fSMasahiro Yamada#define __SYSCALL(nr, func) syscall nr, func 34796a8fae0SRussell King 348dd35afc2SNicolas Pitre/* 349dd35afc2SNicolas Pitre * This is the syscall table declaration for native ABI syscalls. 350dd35afc2SNicolas Pitre * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall. 351dd35afc2SNicolas Pitre */ 35296a8fae0SRussell King syscall_table_start sys_call_table 353dd35afc2SNicolas Pitre#ifdef CONFIG_AEABI 35496a8fae0SRussell King#include <calls-eabi.S> 355dd35afc2SNicolas Pitre#else 35696a8fae0SRussell King#include <calls-oabi.S> 357dd35afc2SNicolas Pitre#endif 35896a8fae0SRussell King syscall_table_end sys_call_table 3591da177e4SLinus Torvalds 3601da177e4SLinus Torvalds/*============================================================================ 3611da177e4SLinus Torvalds * Special system call wrappers 3621da177e4SLinus Torvalds */ 3631da177e4SLinus Torvalds@ r0 = syscall number 364567bd980SRussell King@ r8 = syscall table 3651da177e4SLinus Torvaldssys_syscall: 3665247593cSPaul Brook bic scno, r0, #__NR_OABI_SYSCALL_BASE 3671da177e4SLinus Torvalds cmp scno, #__NR_syscall - __NR_SYSCALL_BASE 3681da177e4SLinus Torvalds cmpne scno, #NR_syscalls @ check range 36910573ae5SRussell King#ifdef CONFIG_CPU_SPECTRE 37010573ae5SRussell King movhs scno, #0 37110573ae5SRussell King csdb 37210573ae5SRussell King#endif 373e44fc388SStefan Agner stmialo sp, {r5, r6} @ shuffle args 3741da177e4SLinus Torvalds movlo r0, r1 3751da177e4SLinus Torvalds movlo r1, r2 3761da177e4SLinus Torvalds movlo r2, r3 3771da177e4SLinus Torvalds movlo r3, r4 3781da177e4SLinus Torvalds ldrlo pc, [tbl, scno, lsl #2] 3791da177e4SLinus Torvalds b sys_ni_syscall 38093ed3970SCatalin MarinasENDPROC(sys_syscall) 3811da177e4SLinus Torvalds 3821da177e4SLinus Torvaldssys_sigreturn_wrapper: 3831da177e4SLinus Torvalds add r0, sp, #S_OFF 384653d48b2SAl Viro mov why, #0 @ prevent syscall restart handling 3851da177e4SLinus Torvalds b sys_sigreturn 38693ed3970SCatalin MarinasENDPROC(sys_sigreturn_wrapper) 3871da177e4SLinus Torvalds 3881da177e4SLinus Torvaldssys_rt_sigreturn_wrapper: 3891da177e4SLinus Torvalds add r0, sp, #S_OFF 390653d48b2SAl Viro mov why, #0 @ prevent syscall restart handling 3911da177e4SLinus Torvalds b sys_rt_sigreturn 39293ed3970SCatalin MarinasENDPROC(sys_rt_sigreturn_wrapper) 3931da177e4SLinus Torvalds 394713c4815SNicolas Pitresys_statfs64_wrapper: 395713c4815SNicolas Pitre teq r1, #88 396713c4815SNicolas Pitre moveq r1, #84 397713c4815SNicolas Pitre b sys_statfs64 39893ed3970SCatalin MarinasENDPROC(sys_statfs64_wrapper) 399713c4815SNicolas Pitre 400713c4815SNicolas Pitresys_fstatfs64_wrapper: 401713c4815SNicolas Pitre teq r1, #88 402713c4815SNicolas Pitre moveq r1, #84 403713c4815SNicolas Pitre b sys_fstatfs64 40493ed3970SCatalin MarinasENDPROC(sys_fstatfs64_wrapper) 405713c4815SNicolas Pitre 4061da177e4SLinus Torvalds/* 4071da177e4SLinus Torvalds * Note: off_4k (r5) is always units of 4K. If we can't do the requested 4081da177e4SLinus Torvalds * offset, we return EINVAL. 4091da177e4SLinus Torvalds */ 4101da177e4SLinus Torvaldssys_mmap2: 4111da177e4SLinus Torvalds str r5, [sp, #4] 412f8b72560SAl Viro b sys_mmap_pgoff 41393ed3970SCatalin MarinasENDPROC(sys_mmap2) 414687ad019SNicolas Pitre 415687ad019SNicolas Pitre#ifdef CONFIG_OABI_COMPAT 416dd35afc2SNicolas Pitre 417687ad019SNicolas Pitre/* 418687ad019SNicolas Pitre * These are syscalls with argument register differences 419687ad019SNicolas Pitre */ 420687ad019SNicolas Pitre 421687ad019SNicolas Pitresys_oabi_pread64: 422687ad019SNicolas Pitre stmia sp, {r3, r4} 423687ad019SNicolas Pitre b sys_pread64 42493ed3970SCatalin MarinasENDPROC(sys_oabi_pread64) 425687ad019SNicolas Pitre 426687ad019SNicolas Pitresys_oabi_pwrite64: 427687ad019SNicolas Pitre stmia sp, {r3, r4} 428687ad019SNicolas Pitre b sys_pwrite64 42993ed3970SCatalin MarinasENDPROC(sys_oabi_pwrite64) 430687ad019SNicolas Pitre 431687ad019SNicolas Pitresys_oabi_truncate64: 432687ad019SNicolas Pitre mov r3, r2 433687ad019SNicolas Pitre mov r2, r1 434687ad019SNicolas Pitre b sys_truncate64 43593ed3970SCatalin MarinasENDPROC(sys_oabi_truncate64) 436687ad019SNicolas Pitre 437687ad019SNicolas Pitresys_oabi_ftruncate64: 438687ad019SNicolas Pitre mov r3, r2 439687ad019SNicolas Pitre mov r2, r1 440687ad019SNicolas Pitre b sys_ftruncate64 44193ed3970SCatalin MarinasENDPROC(sys_oabi_ftruncate64) 442687ad019SNicolas Pitre 443687ad019SNicolas Pitresys_oabi_readahead: 444687ad019SNicolas Pitre str r3, [sp] 445687ad019SNicolas Pitre mov r3, r2 446687ad019SNicolas Pitre mov r2, r1 447687ad019SNicolas Pitre b sys_readahead 44893ed3970SCatalin MarinasENDPROC(sys_oabi_readahead) 449687ad019SNicolas Pitre 450dd35afc2SNicolas Pitre/* 451dd35afc2SNicolas Pitre * Let's declare a second syscall table for old ABI binaries 452dd35afc2SNicolas Pitre * using the compatibility syscall entries. 453dd35afc2SNicolas Pitre */ 45496a8fae0SRussell King syscall_table_start sys_oabi_call_table 4550047eb9fSMasahiro Yamada#undef __SYSCALL_WITH_COMPAT 4560047eb9fSMasahiro Yamada#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) 45796a8fae0SRussell King#include <calls-oabi.S> 45896a8fae0SRussell King syscall_table_end sys_oabi_call_table 459dd35afc2SNicolas Pitre 460687ad019SNicolas Pitre#endif 461687ad019SNicolas Pitre 462