/*1* Linux/PA-RISC Project (http://www.parisc-linux.org/)2*3* System call entry code / Linux gateway page4* Copyright (c) Matthew Wilcox 1999 <[email protected]>5* Licensed under the GNU GPL.6* thanks to Philipp Rumpf, Mike Shaver and various others7* sorry about the wall, puffin..8*/910/*11How does the Linux gateway page on PA-RISC work?12------------------------------------------------13The Linux gateway page on PA-RISC is "special".14It actually has PAGE_GATEWAY bits set (this is linux terminology; in parisc15terminology it's Execute, promote to PL0) in the page map. So anything16executing on this page executes with kernel level privilege (there's more to it17than that: to have this happen, you also have to use a branch with a ,gate18completer to activate the privilege promotion). The upshot is that everything19that runs on the gateway page runs at kernel privilege but with the current20user process address space (although you have access to kernel space via %sr2).21For the 0x100 syscall entry, we redo the space registers to point to the kernel22address space (preserving the user address space in %sr3), move to wide mode if23required, save the user registers and branch into the kernel syscall entry24point. For all the other functions, we execute at kernel privilege but don't25flip address spaces. The basic upshot of this is that these code snippets are26executed atomically (because the kernel can't be pre-empted) and they may27perform architecturally forbidden (to PL3) operations (like setting control28registers).29*/303132#include <asm/asm-offsets.h>33#include <asm/unistd.h>34#include <asm/errno.h>35#include <asm/page.h>36#include <asm/psw.h>37#include <asm/thread_info.h>38#include <asm/assembly.h>39#include <asm/processor.h>40#include <asm/cache.h>41#include <asm/spinlock_types.h>4243#include <linux/linkage.h>4445/* We fill the empty parts of the gateway page with46* something that will kill the kernel or a47* userspace application.48*/49#define KILL_INSN break 0,05051.level PA_ASM_LEVEL5253.macro lws_pagefault_disable reg1,reg254mfctl %cr30, \reg255ldo TASK_PAGEFAULT_DISABLED(\reg2), \reg256ldw 0(%sr2,\reg2), \reg157ldo 1(\reg1), \reg158stw \reg1, 0(%sr2,\reg2)59.endm6061.macro lws_pagefault_enable reg1,reg262mfctl %cr30, \reg263ldo TASK_PAGEFAULT_DISABLED(\reg2), \reg264ldw 0(%sr2,\reg2), \reg165ldo -1(\reg1), \reg166stw \reg1, 0(%sr2,\reg2)67.endm6869/* raise exception if spinlock content is not zero or70* __ARCH_SPIN_LOCK_UNLOCKED_VAL */71.macro spinlock_check spin_val,tmpreg72#ifdef CONFIG_LIGHTWEIGHT_SPINLOCK_CHECK73ldi __ARCH_SPIN_LOCK_UNLOCKED_VAL, \tmpreg74andcm,= \spin_val, \tmpreg, %r075.word SPINLOCK_BREAK_INSN76#endif77.endm7879.text8081.import syscall_exit,code82.import syscall_exit_rfi,code8384/* Linux gateway page is aliased to virtual page 0 in the kernel85* address space. Since it is a gateway page it cannot be86* dereferenced, so null pointers will still fault. We start87* the actual entry point at 0x100. We put break instructions88* at the beginning of the page to trap null indirect function89* pointers.90*/9192.align PAGE_SIZE93ENTRY(linux_gateway_page)9495/* ADDRESS 0x00 to 0xb0 = 176 bytes / 4 bytes per insn = 44 insns */96.rept 4497KILL_INSN98.endr99100/* ADDRESS 0xb0 to 0xb8, lws uses two insns for entry */101/* Light-weight-syscall entry must always be located at 0xb0 */102/* WARNING: Keep this number updated with table size changes */103#define __NR_lws_entries (5)104105lws_entry:106gate lws_start, %r0 /* increase privilege */107depi PRIV_USER, 31, 2, %r31 /* Ensure we return into user mode. */108109/* Fill from 0xb8 to 0xe0 */110.rept 10111KILL_INSN112.endr113114/* This function MUST be located at 0xe0 for glibc's threading115mechanism to work. DO NOT MOVE THIS CODE EVER! */116set_thread_pointer:117gate .+8, %r0 /* increase privilege */118depi PRIV_USER, 31, 2, %r31 /* Ensure we return into user mode. */119be 0(%sr7,%r31) /* return to user space */120mtctl %r26, %cr27 /* move arg0 to the control register */121122/* Increase the chance of trapping if random jumps occur to this123address, fill from 0xf0 to 0x100 */124.rept 4125KILL_INSN126.endr127128/* This address must remain fixed at 0x100 for glibc's syscalls to work */129.align LINUX_GATEWAY_ADDR130linux_gateway_entry:131gate .+8, %r0 /* become privileged */132mtsp %r0,%sr4 /* get kernel space into sr4 */133mtsp %r0,%sr5 /* get kernel space into sr5 */134mtsp %r0,%sr6 /* get kernel space into sr6 */135136#ifdef CONFIG_64BIT137/* Store W bit on entry to the syscall in case it's a wide userland138* process. */139ssm PSW_SM_W, %r1140extrd,u %r1,PSW_W_BIT,1,%r1141/* sp must be aligned on 4, so deposit the W bit setting into142* the bottom of sp temporarily */143or,ev %r1,%r30,%r30144b,n 1f145/* The top halves of argument registers must be cleared on syscall146* entry from narrow executable.147*/148depdi 0, 31, 32, %r26149depdi 0, 31, 32, %r25150depdi 0, 31, 32, %r24151depdi 0, 31, 32, %r23152depdi 0, 31, 32, %r22153depdi 0, 31, 32, %r211541:155#endif156157/* We use a rsm/ssm pair to prevent sr3 from being clobbered158* by external interrupts.159*/160mfsp %sr7,%r1 /* save user sr7 */161rsm PSW_SM_I, %r0 /* disable interrupts */162mtsp %r1,%sr3 /* and store it in sr3 */163164mfctl %cr30,%r1165xor %r1,%r30,%r30 /* ye olde xor trick */166xor %r1,%r30,%r1167xor %r1,%r30,%r30168169LDREG TASK_STACK(%r30),%r30 /* set up kernel stack */170ldo FRAME_SIZE(%r30),%r30171/* N.B.: It is critical that we don't set sr7 to 0 until r30172* contains a valid kernel stack pointer. It is also173* critical that we don't start using the kernel stack174* until after sr7 has been set to 0.175*/176177mtsp %r0,%sr7 /* get kernel space into sr7 */178ssm PSW_SM_I, %r0 /* enable interrupts */179STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */180mfctl %cr30,%r1 /* get task ptr in %r1 */181182/* Save some registers for sigcontext and potential task183switch (see entry.S for the details of which ones are184saved/restored). TASK_PT_PSW is zeroed so we can see whether185a process is on a syscall or not. For an interrupt the real186PSW value is stored. This is needed for gdb and sys_ptrace. */187STREG %r0, TASK_PT_PSW(%r1)188STREG %r2, TASK_PT_GR2(%r1) /* preserve rp */189STREG %r19, TASK_PT_GR19(%r1)190191LDREGM -FRAME_SIZE(%r30), %r2 /* get users sp back */192#ifdef CONFIG_64BIT193extrd,u %r2,63,1,%r19 /* W hidden in bottom bit */194#if 0195xor %r19,%r2,%r2 /* clear bottom bit */196depd,z %r19,1,1,%r19197std %r19,TASK_PT_PSW(%r1)198#endif199#endif200STREG %r2, TASK_PT_GR30(%r1) /* ... and save it */201202STREG %r20, TASK_PT_GR20(%r1) /* Syscall number */203STREG %r21, TASK_PT_GR21(%r1)204STREG %r22, TASK_PT_GR22(%r1)205STREG %r23, TASK_PT_GR23(%r1) /* 4th argument */206STREG %r24, TASK_PT_GR24(%r1) /* 3rd argument */207STREG %r25, TASK_PT_GR25(%r1) /* 2nd argument */208STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */209STREG %r27, TASK_PT_GR27(%r1) /* user dp */210STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */211STREG %r0, TASK_PT_ORIG_R28(%r1) /* don't prohibit restarts */212STREG %r29, TASK_PT_GR29(%r1) /* return value 1 */213STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */214215ldo TASK_PT_FR0(%r1), %r27 /* save fpregs from the kernel */216save_fp %r27 /* or potential task switch */217218mfctl %cr11, %r27 /* i.e. SAR */219STREG %r27, TASK_PT_SAR(%r1)220221loadgp222223#ifdef CONFIG_64BIT224ldo -16(%r30),%r29 /* Reference param save area */225copy %r19,%r2 /* W bit back to r2 */226#else227/* no need to save these on stack in wide mode because the first 8228* args are passed in registers */229stw %r22, -52(%r30) /* 5th argument */230stw %r21, -56(%r30) /* 6th argument */231#endif232233/* Are we being ptraced? */234mfctl %cr30, %r1235LDREG TASK_TI_FLAGS(%r1),%r1236ldi _TIF_SYSCALL_TRACE_MASK, %r19237and,COND(=) %r1, %r19, %r0238b,n .Ltracesys239240/* Note! We cannot use the syscall table that is mapped241nearby since the gateway page is mapped execute-only. */242243#ifdef CONFIG_64BIT244ldil L%sys_call_table, %r1245or,ev %r2,%r2,%r2246ldil L%sys_call_table64, %r1247ldo R%sys_call_table(%r1), %r19248or,ev %r2,%r2,%r2249ldo R%sys_call_table64(%r1), %r19250#else251load32 sys_call_table, %r19252#endif253comiclr,>> __NR_Linux_syscalls, %r20, %r0254b,n .Lsyscall_nosys255256LDREGX %r20(%r19), %r19257258/* If this is a sys_rt_sigreturn call, and the signal was received259* when not in_syscall, then we want to return via syscall_exit_rfi,260* not syscall_exit. Signal no. in r20, in_syscall in r25 (see261* trampoline code in signal.c).262*/263ldi __NR_rt_sigreturn,%r2264comb,= %r2,%r20,.Lrt_sigreturn265.Lin_syscall:266ldil L%syscall_exit,%r2267be 0(%sr7,%r19)268ldo R%syscall_exit(%r2),%r2269.Lrt_sigreturn:270comib,<> 0,%r25,.Lin_syscall271ldil L%syscall_exit_rfi,%r2272be 0(%sr7,%r19)273ldo R%syscall_exit_rfi(%r2),%r2274275/* Note! Because we are not running where we were linked, any276calls to functions external to this file must be indirect. To277be safe, we apply the opposite rule to functions within this278file, with local labels given to them to ensure correctness. */279280.Lsyscall_nosys:281syscall_nosys:282ldil L%syscall_exit,%r1283be R%syscall_exit(%sr7,%r1)284ldo -ENOSYS(%r0),%r28 /* set errno */285286287/* Warning! This trace code is a virtual duplicate of the code above so be288* sure to maintain both! */289.Ltracesys:290tracesys:291/* Need to save more registers so the debugger can see where we292* are. This saves only the lower 8 bits of PSW, so that the C293* bit is still clear on syscalls, and the D bit is set if this294* full register save path has been executed. We check the D295* bit on syscall_return_rfi to determine which registers to296* restore. An interrupt results in a full PSW saved with the297* C bit set, a non-straced syscall entry results in C and D clear298* in the saved PSW.299*/300mfctl %cr30,%r1 /* get task ptr */301ssm 0,%r2302STREG %r2,TASK_PT_PSW(%r1) /* Lower 8 bits only!! */303mfsp %sr0,%r2304STREG %r2,TASK_PT_SR0(%r1)305mfsp %sr1,%r2306STREG %r2,TASK_PT_SR1(%r1)307mfsp %sr2,%r2308STREG %r2,TASK_PT_SR2(%r1)309mfsp %sr3,%r2310STREG %r2,TASK_PT_SR3(%r1)311STREG %r2,TASK_PT_SR4(%r1)312STREG %r2,TASK_PT_SR5(%r1)313STREG %r2,TASK_PT_SR6(%r1)314STREG %r2,TASK_PT_SR7(%r1)315STREG %r2,TASK_PT_IASQ0(%r1)316STREG %r2,TASK_PT_IASQ1(%r1)317LDREG TASK_PT_GR31(%r1),%r2318STREG %r2,TASK_PT_IAOQ0(%r1)319ldo 4(%r2),%r2320STREG %r2,TASK_PT_IAOQ1(%r1)321ldo TASK_REGS(%r1),%r2322/* reg_save %r2 */323STREG %r3,PT_GR3(%r2)324STREG %r4,PT_GR4(%r2)325STREG %r5,PT_GR5(%r2)326STREG %r6,PT_GR6(%r2)327STREG %r7,PT_GR7(%r2)328STREG %r8,PT_GR8(%r2)329STREG %r9,PT_GR9(%r2)330STREG %r10,PT_GR10(%r2)331STREG %r11,PT_GR11(%r2)332STREG %r12,PT_GR12(%r2)333STREG %r13,PT_GR13(%r2)334STREG %r14,PT_GR14(%r2)335STREG %r15,PT_GR15(%r2)336STREG %r16,PT_GR16(%r2)337STREG %r17,PT_GR17(%r2)338STREG %r18,PT_GR18(%r2)339/* Finished saving things for the debugger */340341copy %r2,%r26342ldil L%do_syscall_trace_enter,%r1343ldil L%tracesys_next,%r2344be R%do_syscall_trace_enter(%sr7,%r1)345ldo R%tracesys_next(%r2),%r2346347tracesys_next:348/* do_syscall_trace_enter either returned the syscallno, or -1L,349* so we skip restoring the PT_GR20 below, since we pulled it from350* task->thread.regs.gr[20] above.351*/352copy %ret0,%r20353354mfctl %cr30,%r1 /* get task ptr */355LDREG TASK_PT_GR28(%r1), %r28 /* Restore return value */356LDREG TASK_PT_GR26(%r1), %r26 /* Restore the users args */357LDREG TASK_PT_GR25(%r1), %r25358LDREG TASK_PT_GR24(%r1), %r24359LDREG TASK_PT_GR23(%r1), %r23360LDREG TASK_PT_GR22(%r1), %r22361LDREG TASK_PT_GR21(%r1), %r21362#ifdef CONFIG_64BIT363ldo -16(%r30),%r29 /* Reference param save area */364#else365stw %r22, -52(%r30) /* 5th argument */366stw %r21, -56(%r30) /* 6th argument */367#endif368369cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */370comiclr,>> __NR_Linux_syscalls, %r20, %r0371b,n .Ltracesys_nosys372373/* Note! We cannot use the syscall table that is mapped374nearby since the gateway page is mapped execute-only. */375376#ifdef CONFIG_64BIT377LDREG TASK_PT_GR30(%r1), %r19 /* get users sp back */378extrd,u %r19,63,1,%r2 /* W hidden in bottom bit */379380ldil L%sys_call_table, %r1381or,ev %r2,%r2,%r2382ldil L%sys_call_table64, %r1383ldo R%sys_call_table(%r1), %r19384or,ev %r2,%r2,%r2385ldo R%sys_call_table64(%r1), %r19386#else387load32 sys_call_table, %r19388#endif389390LDREGX %r20(%r19), %r19391392/* If this is a sys_rt_sigreturn call, and the signal was received393* when not in_syscall, then we want to return via syscall_exit_rfi,394* not syscall_exit. Signal no. in r20, in_syscall in r25 (see395* trampoline code in signal.c).396*/397ldi __NR_rt_sigreturn,%r2398comb,= %r2,%r20,.Ltrace_rt_sigreturn399.Ltrace_in_syscall:400ldil L%tracesys_exit,%r2401be 0(%sr7,%r19)402ldo R%tracesys_exit(%r2),%r2403404.Ltracesys_nosys:405ldo -ENOSYS(%r0),%r28 /* set errno */406407/* Do *not* call this function on the gateway page, because it408makes a direct call to syscall_trace. */409410tracesys_exit:411mfctl %cr30,%r1 /* get task ptr */412#ifdef CONFIG_64BIT413ldo -16(%r30),%r29 /* Reference param save area */414#endif415ldo TASK_REGS(%r1),%r26416BL do_syscall_trace_exit,%r2417STREG %r28,TASK_PT_GR28(%r1) /* save return value now */418mfctl %cr30,%r1 /* get task ptr */419LDREG TASK_PT_GR28(%r1), %r28 /* Restore return val. */420421ldil L%syscall_exit,%r1422be,n R%syscall_exit(%sr7,%r1)423424.Ltrace_rt_sigreturn:425comib,<> 0,%r25,.Ltrace_in_syscall426ldil L%tracesys_sigexit,%r2427be 0(%sr7,%r19)428ldo R%tracesys_sigexit(%r2),%r2429430tracesys_sigexit:431mfctl %cr30,%r1 /* get task ptr */432#ifdef CONFIG_64BIT433ldo -16(%r30),%r29 /* Reference param save area */434#endif435BL do_syscall_trace_exit,%r2436ldo TASK_REGS(%r1),%r26437438ldil L%syscall_exit_rfi,%r1439be,n R%syscall_exit_rfi(%sr7,%r1)440441442/*********************************************************44332/64-bit Light-Weight-Syscall ABI444445* - Indicates a hint for userspace inline asm446implementations.447448Syscall number (caller-saves)449- %r20450* In asm clobber.451452Argument registers (caller-saves)453- %r26, %r25, %r24, %r23, %r22454* In asm input.455456Return registers (caller-saves)457- %r28 (return), %r21 (errno)458* In asm output.459460Caller-saves registers461- %r1, %r27, %r29462- %r2 (return pointer)463- %r31 (ble link register)464* In asm clobber.465466Callee-saves registers467- %r3-%r18468- %r30 (stack pointer)469* Not in asm clobber.470471If userspace is 32-bit:472Callee-saves registers473- %r19 (32-bit PIC register)474475Differences from 32-bit calling convention:476- Syscall number in %r20477- Additional argument register %r22 (arg4)478- Callee-saves %r19.479480If userspace is 64-bit:481Callee-saves registers482- %r27 (64-bit PIC register)483484Differences from 64-bit calling convention:485- Syscall number in %r20486- Additional argument register %r22 (arg4)487- Callee-saves %r27.488489Error codes returned by entry path:490491ENOSYS - r20 was an invalid LWS number.492493*********************************************************/494lws_start:495496#ifdef CONFIG_64BIT497ssm PSW_SM_W, %r1498extrd,u %r1,PSW_W_BIT,1,%r1499/* sp must be aligned on 4, so deposit the W bit setting into500* the bottom of sp temporarily */501or,od %r1,%r30,%r30502503/* Clip LWS number to a 32-bit value for 32-bit processes */504depdi 0, 31, 32, %r20505#endif506507/* Is the lws entry number valid? */508comiclr,>> __NR_lws_entries, %r20, %r0509b,n lws_exit_nosys510511/* Load table start */512ldil L%lws_table, %r1513ldo R%lws_table(%r1), %r28 /* Scratch use of r28 */514LDREGX %r20(%sr2,r28), %r21 /* Scratch use of r21 */515516/* Jump to lws, lws table pointers already relocated */517be,n 0(%sr2,%r21)518519lws_exit_noerror:520lws_pagefault_enable %r1,%r21521ldi __ARCH_SPIN_LOCK_UNLOCKED_VAL, %r21522stw,ma %r21, 0(%sr2,%r20)523ssm PSW_SM_I, %r0524b lws_exit525copy %r0, %r21526527lws_wouldblock:528ssm PSW_SM_I, %r0529ldo 2(%r0), %r28530b lws_exit531ldo -EAGAIN(%r0), %r21532533lws_pagefault:534lws_pagefault_enable %r1,%r21535ldi __ARCH_SPIN_LOCK_UNLOCKED_VAL, %r21536stw,ma %r21, 0(%sr2,%r20)537ssm PSW_SM_I, %r0538ldo 3(%r0),%r28539b lws_exit540ldo -EAGAIN(%r0),%r21541542lws_fault:543ldo 1(%r0),%r28544b lws_exit545ldo -EFAULT(%r0),%r21546547lws_exit_nosys:548ldo -ENOSYS(%r0),%r21549/* Fall through: Return to userspace */550551lws_exit:552#ifdef CONFIG_64BIT553/* decide whether to reset the wide mode bit554*555* For a syscall, the W bit is stored in the lowest bit556* of sp. Extract it and reset W if it is zero */557extrd,u,*<> %r30,63,1,%r1558rsm PSW_SM_W, %r0559/* now reset the lowest bit of sp if it was set */560xor %r30,%r1,%r30561#endif562be,n 0(%sr7, %r31)563564565566/***************************************************567Implementing 32bit CAS as an atomic operation:568569%r26 - Address to examine570%r25 - Old value to check (old)571%r24 - New value to set (new)572%r28 - Return prev through this register.573%r21 - Kernel error code574575%r21 returns the following error codes:576EAGAIN - CAS is busy, ldcw failed, try again.577EFAULT - Read or write failed.578579If EAGAIN is returned, %r28 indicates the busy reason:580r28 == 1 - CAS is busy. lock contended.581r28 == 2 - CAS is busy. ldcw failed.582r28 == 3 - CAS is busy. page fault.583584Scratch: r20, r28, r1585586****************************************************/587588/* ELF64 Process entry path */589lws_compare_and_swap64:590#ifdef CONFIG_64BIT591b,n lws_compare_and_swap592#else593/* If we are not a 64-bit kernel, then we don't594* have 64-bit input registers, and calling595* the 64-bit LWS CAS returns ENOSYS.596*/597b,n lws_exit_nosys598#endif599600/* ELF32/ELF64 Process entry path */601lws_compare_and_swap32:602#ifdef CONFIG_64BIT603/* Wide mode user process? */604bb,<,n %sp, 31, lws_compare_and_swap605606/* Clip all the input registers for 32-bit processes */607depdi 0, 31, 32, %r26608depdi 0, 31, 32, %r25609depdi 0, 31, 32, %r24610#endif611612lws_compare_and_swap:613/* Trigger memory reference interruptions without writing to memory */6141: ldw 0(%r26), %r28615proberi (%r26), PRIV_USER, %r28616comb,=,n %r28, %r0, lws_fault /* backwards, likely not taken */617nop6182: stbys,e %r0, 0(%r26)619620/* Calculate 8-bit hash index from virtual address */621extru_safe %r26, 27, 8, %r20622623/* Load start of lock table */624ldil L%lws_lock_start, %r28625ldo R%lws_lock_start(%r28), %r28626627/* Find lock to use, the hash index is one of 0 to628255, multiplied by 16 (keep it 16-byte aligned)629and add to the lock table offset. */630shlw %r20, 4, %r20631add %r20, %r28, %r20632633rsm PSW_SM_I, %r0 /* Disable interrupts */634635/* Try to acquire the lock */636LDCW 0(%sr2,%r20), %r28637spinlock_check %r28, %r21638comclr,<> %r0, %r28, %r0639b,n lws_wouldblock640641/* Disable page faults to prevent sleeping in critical region */642lws_pagefault_disable %r21,%r28643644/*645prev = *addr;646if ( prev == old )647*addr = new;648return prev;649*/650651/* NOTES:652This all works because intr_do_signal653and schedule both check the return iasq654and see that we are on the kernel page655so this process is never scheduled off656or is ever sent any signal of any sort,657thus it is wholly atomic from usrspace's658perspective659*/660/* The load and store could fail */6613: ldw 0(%r26), %r28662sub,<> %r28, %r25, %r06634: stw %r24, 0(%r26)664b,n lws_exit_noerror665666/* A fault occurred on load or stbys,e store */6675: b,n lws_fault668ASM_EXCEPTIONTABLE_ENTRY(1b-linux_gateway_page, 5b-linux_gateway_page)669ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 5b-linux_gateway_page)670671/* A page fault occurred in critical region */6726: b,n lws_pagefault673ASM_EXCEPTIONTABLE_ENTRY(3b-linux_gateway_page, 6b-linux_gateway_page)674ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 6b-linux_gateway_page)675676677/***************************************************678New CAS implementation which uses pointers and variable size679information. The value pointed by old and new MUST NOT change680while performing CAS. The lock only protects the value at %r26.681682%r26 - Address to examine683%r25 - Pointer to the value to check (old)684%r24 - Pointer to the value to set (new)685%r23 - Size of the variable (0/1/2/3 for 8/16/32/64 bit)686%r28 - Return non-zero on failure687%r21 - Kernel error code688689%r21 returns the following error codes:690EAGAIN - CAS is busy, ldcw failed, try again.691EFAULT - Read or write failed.692693If EAGAIN is returned, %r28 indicates the busy reason:694r28 == 1 - CAS is busy. lock contended.695r28 == 2 - CAS is busy. ldcw failed.696r28 == 3 - CAS is busy. page fault.697698Scratch: r20, r22, r28, r29, r1, fr4 (32bit for 64bit CAS only)699700****************************************************/701702lws_compare_and_swap_2:703#ifdef CONFIG_64BIT704/* Wide mode user process? */705bb,<,n %sp, 31, cas2_begin706707/* Clip the input registers for 32-bit processes. We don't708need to clip %r23 as we only use it for word operations */709depdi 0, 31, 32, %r26710depdi 0, 31, 32, %r25711depdi 0, 31, 32, %r24712#endif713714cas2_begin:715/* Check the validity of the size pointer */716subi,>>= 3, %r23, %r0717b,n lws_exit_nosys718719/* Jump to the functions which will load the old and new values into720registers depending on the their size */721shlw %r23, 2, %r29722blr %r29, %r0723nop724725/* 8-bit load */7261: ldb 0(%r25), %r25727b cas2_lock_start7282: ldb 0(%r24), %r24729nop730nop731nop732nop733nop734735/* 16-bit load */7363: ldh 0(%r25), %r25737b cas2_lock_start7384: ldh 0(%r24), %r24739nop740nop741nop742nop743nop744745/* 32-bit load */7465: ldw 0(%r25), %r25747b cas2_lock_start7486: ldw 0(%r24), %r24749nop750nop751nop752nop753nop754755/* 64-bit load */756#ifdef CONFIG_64BIT7577: ldd 0(%r25), %r257588: ldd 0(%r24), %r24759#else760/* Load old value into r22/r23 - high/low */7617: ldw 0(%r25), %r227628: ldw 4(%r25), %r23763/* Load new value into fr4 for atomic store later */7649: flddx 0(%r24), %fr4765#endif766767cas2_lock_start:768/* Trigger memory reference interruptions without writing to memory */769copy %r26, %r28770depi_safe 0, 31, 2, %r2877110: ldw 0(%r28), %r1772proberi (%r28), PRIV_USER, %r1773comb,=,n %r1, %r0, lws_fault /* backwards, likely not taken */774nop77511: stbys,e %r0, 0(%r28)776777/* Calculate 8-bit hash index from virtual address */778extru_safe %r26, 27, 8, %r20779780/* Load start of lock table */781ldil L%lws_lock_start, %r28782ldo R%lws_lock_start(%r28), %r28783784/* Find lock to use, the hash index is one of 0 to785255, multiplied by 16 (keep it 16-byte aligned)786and add to the lock table offset. */787shlw %r20, 4, %r20788add %r20, %r28, %r20789790rsm PSW_SM_I, %r0 /* Disable interrupts */791792/* Try to acquire the lock */793LDCW 0(%sr2,%r20), %r28794spinlock_check %r28, %r21795comclr,<> %r0, %r28, %r0796b,n lws_wouldblock797798/* Disable page faults to prevent sleeping in critical region */799lws_pagefault_disable %r21,%r28800801/*802prev = *addr;803if ( prev == old )804*addr = new;805return prev;806*/807808/* NOTES:809This all works because intr_do_signal810and schedule both check the return iasq811and see that we are on the kernel page812so this process is never scheduled off813or is ever sent any signal of any sort,814thus it is wholly atomic from usrspace's815perspective816*/817818/* Jump to the correct function */819blr %r29, %r0820/* Set %r28 as non-zero for now */821ldo 1(%r0),%r28822823/* 8-bit CAS */82412: ldb 0(%r26), %r29825sub,= %r29, %r25, %r0826b,n lws_exit_noerror82713: stb %r24, 0(%r26)828b lws_exit_noerror829copy %r0, %r28830nop831nop832833/* 16-bit CAS */83414: ldh 0(%r26), %r29835sub,= %r29, %r25, %r0836b,n lws_exit_noerror83715: sth %r24, 0(%r26)838b lws_exit_noerror839copy %r0, %r28840nop841nop842843/* 32-bit CAS */84416: ldw 0(%r26), %r29845sub,= %r29, %r25, %r0846b,n lws_exit_noerror84717: stw %r24, 0(%r26)848b lws_exit_noerror849copy %r0, %r28850nop851nop852853/* 64-bit CAS */854#ifdef CONFIG_64BIT85518: ldd 0(%r26), %r29856sub,*= %r29, %r25, %r0857b,n lws_exit_noerror85819: std %r24, 0(%r26)859copy %r0, %r28860#else861/* Compare first word */86218: ldw 0(%r26), %r29863sub,= %r29, %r22, %r0864b,n lws_exit_noerror865/* Compare second word */86619: ldw 4(%r26), %r29867sub,= %r29, %r23, %r0868b,n lws_exit_noerror869/* Perform the store */87020: fstdx %fr4, 0(%r26)871copy %r0, %r28872#endif873b lws_exit_noerror874copy %r0, %r28875876/* A fault occurred on load or stbys,e store */87730: b,n lws_fault878ASM_EXCEPTIONTABLE_ENTRY(1b-linux_gateway_page, 30b-linux_gateway_page)879ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 30b-linux_gateway_page)880ASM_EXCEPTIONTABLE_ENTRY(3b-linux_gateway_page, 30b-linux_gateway_page)881ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 30b-linux_gateway_page)882ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 30b-linux_gateway_page)883ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 30b-linux_gateway_page)884ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 30b-linux_gateway_page)885ASM_EXCEPTIONTABLE_ENTRY(8b-linux_gateway_page, 30b-linux_gateway_page)886#ifndef CONFIG_64BIT887ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 30b-linux_gateway_page)888#endif889890ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 30b-linux_gateway_page)891ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 30b-linux_gateway_page)892893/* A page fault occurred in critical region */89431: b,n lws_pagefault895ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 31b-linux_gateway_page)896ASM_EXCEPTIONTABLE_ENTRY(13b-linux_gateway_page, 31b-linux_gateway_page)897ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 31b-linux_gateway_page)898ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 31b-linux_gateway_page)899ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 31b-linux_gateway_page)900ASM_EXCEPTIONTABLE_ENTRY(17b-linux_gateway_page, 31b-linux_gateway_page)901ASM_EXCEPTIONTABLE_ENTRY(18b-linux_gateway_page, 31b-linux_gateway_page)902ASM_EXCEPTIONTABLE_ENTRY(19b-linux_gateway_page, 31b-linux_gateway_page)903#ifndef CONFIG_64BIT904ASM_EXCEPTIONTABLE_ENTRY(20b-linux_gateway_page, 31b-linux_gateway_page)905#endif906907908/***************************************************909LWS atomic exchange.910911%r26 - Exchange address912%r25 - Size of the variable (0/1/2/3 for 8/16/32/64 bit)913%r24 - Address of new value914%r23 - Address of old value915%r28 - Return non-zero on failure916%r21 - Kernel error code917918%r21 returns the following error codes:919EAGAIN - CAS is busy, ldcw failed, try again.920EFAULT - Read or write failed.921922If EAGAIN is returned, %r28 indicates the busy reason:923r28 == 1 - CAS is busy. lock contended.924r28 == 2 - CAS is busy. ldcw failed.925r28 == 3 - CAS is busy. page fault.926927Scratch: r20, r1928929****************************************************/930931lws_atomic_xchg:932#ifdef CONFIG_64BIT933/* Wide mode user process? */934bb,<,n %sp, 31, atomic_xchg_begin935936/* Clip the input registers for 32-bit processes. We don't937need to clip %r23 as we only use it for word operations */938depdi 0, 31, 32, %r26939depdi 0, 31, 32, %r25940depdi 0, 31, 32, %r24941depdi 0, 31, 32, %r23942#endif943944atomic_xchg_begin:945/* Check the validity of the size pointer */946subi,>>= 3, %r25, %r0947b,n lws_exit_nosys948949/* Jump to the functions which will load the old and new values into950registers depending on the their size */951shlw %r25, 2, %r1952blr %r1, %r0953nop954955/* Perform exception checks */956957/* 8-bit exchange */9581: ldb 0(%r24), %r20959proberi (%r24), PRIV_USER, %r20960comb,=,n %r20, %r0, lws_fault /* backwards, likely not taken */961nop962copy %r23, %r20963depi_safe 0, 31, 2, %r20964b atomic_xchg_start9652: stbys,e %r0, 0(%r20)966967/* 16-bit exchange */9683: ldh 0(%r24), %r20969proberi (%r24), PRIV_USER, %r20970comb,=,n %r20, %r0, lws_fault /* backwards, likely not taken */971nop972copy %r23, %r20973depi_safe 0, 31, 2, %r20974b atomic_xchg_start9754: stbys,e %r0, 0(%r20)976977/* 32-bit exchange */9785: ldw 0(%r24), %r20979proberi (%r24), PRIV_USER, %r20980comb,=,n %r20, %r0, lws_fault /* backwards, likely not taken */981nop982b atomic_xchg_start9836: stbys,e %r0, 0(%r23)984nop985nop986987/* 64-bit exchange */988#ifdef CONFIG_64BIT9897: ldd 0(%r24), %r20990proberi (%r24), PRIV_USER, %r20991comb,=,n %r20, %r0, lws_fault /* backwards, likely not taken */992nop9938: stdby,e %r0, 0(%r23)994#else9957: ldw 0(%r24), %r209968: ldw 4(%r24), %r20997proberi (%r24), PRIV_USER, %r20998comb,=,n %r20, %r0, lws_fault /* backwards, likely not taken */999nop1000copy %r23, %r201001depi_safe 0, 31, 2, %r2010029: stbys,e %r0, 0(%r20)100310: stbys,e %r0, 4(%r20)1004#endif10051006atomic_xchg_start:1007/* Trigger memory reference interruptions without writing to memory */1008copy %r26, %r281009depi_safe 0, 31, 2, %r28101011: ldw 0(%r28), %r1101112: stbys,e %r0, 0(%r28)10121013/* Calculate 8-bit hash index from virtual address */1014extru_safe %r26, 27, 8, %r2010151016/* Load start of lock table */1017ldil L%lws_lock_start, %r281018ldo R%lws_lock_start(%r28), %r2810191020/* Find lock to use, the hash index is one of 0 to1021255, multiplied by 16 (keep it 16-byte aligned)1022and add to the lock table offset. */1023shlw %r20, 4, %r201024add %r20, %r28, %r2010251026rsm PSW_SM_I, %r0 /* Disable interrupts */10271028/* Try to acquire the lock */1029LDCW 0(%sr2,%r20), %r281030spinlock_check %r28, %r211031comclr,<> %r0, %r28, %r01032b,n lws_wouldblock10331034/* Disable page faults to prevent sleeping in critical region */1035lws_pagefault_disable %r21,%r2810361037/* NOTES:1038This all works because intr_do_signal1039and schedule both check the return iasq1040and see that we are on the kernel page1041so this process is never scheduled off1042or is ever sent any signal of any sort,1043thus it is wholly atomic from userspace's1044perspective1045*/10461047/* Jump to the correct function */1048blr %r1, %r01049/* Set %r28 as non-zero for now */1050ldo 1(%r0),%r2810511052/* 8-bit exchange */105314: ldb 0(%r26), %r1105415: stb %r1, 0(%r23)105515: ldb 0(%r24), %r1105617: stb %r1, 0(%r26)1057b lws_exit_noerror1058copy %r0, %r281059nop1060nop10611062/* 16-bit exchange */106318: ldh 0(%r26), %r1106419: sth %r1, 0(%r23)106520: ldh 0(%r24), %r1106621: sth %r1, 0(%r26)1067b lws_exit_noerror1068copy %r0, %r281069nop1070nop10711072/* 32-bit exchange */107322: ldw 0(%r26), %r1107423: stw %r1, 0(%r23)107524: ldw 0(%r24), %r1107625: stw %r1, 0(%r26)1077b lws_exit_noerror1078copy %r0, %r281079nop1080nop10811082/* 64-bit exchange */1083#ifdef CONFIG_64BIT108426: ldd 0(%r26), %r1108527: std %r1, 0(%r23)108628: ldd 0(%r24), %r1108729: std %r1, 0(%r26)1088#else108926: flddx 0(%r26), %fr4109027: fstdx %fr4, 0(%r23)109128: flddx 0(%r24), %fr4109229: fstdx %fr4, 0(%r26)1093#endif1094b lws_exit_noerror1095copy %r0, %r2810961097/* A fault occurred on load or stbys,e store */109830: b,n lws_fault1099ASM_EXCEPTIONTABLE_ENTRY(1b-linux_gateway_page, 30b-linux_gateway_page)1100ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 30b-linux_gateway_page)1101ASM_EXCEPTIONTABLE_ENTRY(3b-linux_gateway_page, 30b-linux_gateway_page)1102ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 30b-linux_gateway_page)1103ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 30b-linux_gateway_page)1104ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 30b-linux_gateway_page)1105ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 30b-linux_gateway_page)1106ASM_EXCEPTIONTABLE_ENTRY(8b-linux_gateway_page, 30b-linux_gateway_page)1107#ifndef CONFIG_64BIT1108ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 30b-linux_gateway_page)1109ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 30b-linux_gateway_page)1110#endif11111112ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 30b-linux_gateway_page)1113ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 30b-linux_gateway_page)11141115/* A page fault occurred in critical region */111631: b,n lws_pagefault1117ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 31b-linux_gateway_page)1118ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 31b-linux_gateway_page)1119ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 31b-linux_gateway_page)1120ASM_EXCEPTIONTABLE_ENTRY(17b-linux_gateway_page, 31b-linux_gateway_page)1121ASM_EXCEPTIONTABLE_ENTRY(18b-linux_gateway_page, 31b-linux_gateway_page)1122ASM_EXCEPTIONTABLE_ENTRY(19b-linux_gateway_page, 31b-linux_gateway_page)1123ASM_EXCEPTIONTABLE_ENTRY(20b-linux_gateway_page, 31b-linux_gateway_page)1124ASM_EXCEPTIONTABLE_ENTRY(21b-linux_gateway_page, 31b-linux_gateway_page)1125ASM_EXCEPTIONTABLE_ENTRY(22b-linux_gateway_page, 31b-linux_gateway_page)1126ASM_EXCEPTIONTABLE_ENTRY(23b-linux_gateway_page, 31b-linux_gateway_page)1127ASM_EXCEPTIONTABLE_ENTRY(24b-linux_gateway_page, 31b-linux_gateway_page)1128ASM_EXCEPTIONTABLE_ENTRY(25b-linux_gateway_page, 31b-linux_gateway_page)1129ASM_EXCEPTIONTABLE_ENTRY(26b-linux_gateway_page, 31b-linux_gateway_page)1130ASM_EXCEPTIONTABLE_ENTRY(27b-linux_gateway_page, 31b-linux_gateway_page)1131ASM_EXCEPTIONTABLE_ENTRY(28b-linux_gateway_page, 31b-linux_gateway_page)1132ASM_EXCEPTIONTABLE_ENTRY(29b-linux_gateway_page, 31b-linux_gateway_page)11331134/***************************************************1135LWS atomic store.11361137%r26 - Address to store1138%r25 - Size of the variable (0/1/2/3 for 8/16/32/64 bit)1139%r24 - Address of value to store1140%r28 - Return non-zero on failure1141%r21 - Kernel error code11421143%r21 returns the following error codes:1144EAGAIN - CAS is busy, ldcw failed, try again.1145EFAULT - Read or write failed.11461147If EAGAIN is returned, %r28 indicates the busy reason:1148r28 == 1 - CAS is busy. lock contended.1149r28 == 2 - CAS is busy. ldcw failed.1150r28 == 3 - CAS is busy. page fault.11511152Scratch: r20, r111531154****************************************************/11551156lws_atomic_store:1157#ifdef CONFIG_64BIT1158/* Wide mode user process? */1159bb,<,n %sp, 31, atomic_store_begin11601161/* Clip the input registers for 32-bit processes. We don't1162need to clip %r23 as we only use it for word operations */1163depdi 0, 31, 32, %r261164depdi 0, 31, 32, %r251165depdi 0, 31, 32, %r241166#endif11671168atomic_store_begin:1169/* Check the validity of the size pointer */1170subi,>>= 3, %r25, %r01171b,n lws_exit_nosys11721173shlw %r25, 1, %r11174blr %r1, %r01175nop11761177/* Perform exception checks */11781179/* 8-bit store */11801: ldb 0(%r24), %r201181b,n atomic_store_start1182nop1183nop11841185/* 16-bit store */11862: ldh 0(%r24), %r201187b,n atomic_store_start1188nop1189nop11901191/* 32-bit store */11923: ldw 0(%r24), %r201193b,n atomic_store_start1194nop1195nop11961197/* 64-bit store */1198#ifdef CONFIG_64BIT11994: ldd 0(%r24), %r201200#else12014: ldw 0(%r24), %r2012025: ldw 4(%r24), %r201203#endif12041205atomic_store_start:1206/* Trigger memory reference interruptions without writing to memory */1207copy %r26, %r281208depi_safe 0, 31, 2, %r2812096: ldw 0(%r28), %r112107: stbys,e %r0, 0(%r28)12111212/* Calculate 8-bit hash index from virtual address */1213extru_safe %r26, 27, 8, %r2012141215/* Load start of lock table */1216ldil L%lws_lock_start, %r281217ldo R%lws_lock_start(%r28), %r2812181219/* Find lock to use, the hash index is one of 0 to1220255, multiplied by 16 (keep it 16-byte aligned)1221and add to the lock table offset. */1222shlw %r20, 4, %r201223add %r20, %r28, %r2012241225rsm PSW_SM_I, %r0 /* Disable interrupts */12261227/* Try to acquire the lock */1228LDCW 0(%sr2,%r20), %r281229spinlock_check %r28, %r211230comclr,<> %r0, %r28, %r01231b,n lws_wouldblock12321233/* Disable page faults to prevent sleeping in critical region */1234lws_pagefault_disable %r21,%r2812351236/* NOTES:1237This all works because intr_do_signal1238and schedule both check the return iasq1239and see that we are on the kernel page1240so this process is never scheduled off1241or is ever sent any signal of any sort,1242thus it is wholly atomic from userspace's1243perspective1244*/12451246/* Jump to the correct function */1247blr %r1, %r01248/* Set %r28 as non-zero for now */1249ldo 1(%r0),%r2812501251/* 8-bit store */12529: ldb 0(%r24), %r1125310: stb %r1, 0(%r26)1254b lws_exit_noerror1255copy %r0, %r2812561257/* 16-bit store */125811: ldh 0(%r24), %r1125912: sth %r1, 0(%r26)1260b lws_exit_noerror1261copy %r0, %r2812621263/* 32-bit store */126413: ldw 0(%r24), %r1126514: stw %r1, 0(%r26)1266b lws_exit_noerror1267copy %r0, %r2812681269/* 64-bit store */1270#ifdef CONFIG_64BIT127115: ldd 0(%r24), %r1127216: std %r1, 0(%r26)1273#else127415: flddx 0(%r24), %fr4127516: fstdx %fr4, 0(%r26)1276#endif1277b lws_exit_noerror1278copy %r0, %r2812791280/* A fault occurred on load or stbys,e store */128130: b,n lws_fault1282ASM_EXCEPTIONTABLE_ENTRY(1b-linux_gateway_page, 30b-linux_gateway_page)1283ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 30b-linux_gateway_page)1284ASM_EXCEPTIONTABLE_ENTRY(3b-linux_gateway_page, 30b-linux_gateway_page)1285ASM_EXCEPTIONTABLE_ENTRY(4b-linux_gateway_page, 30b-linux_gateway_page)1286#ifndef CONFIG_64BIT1287ASM_EXCEPTIONTABLE_ENTRY(5b-linux_gateway_page, 30b-linux_gateway_page)1288#endif12891290ASM_EXCEPTIONTABLE_ENTRY(6b-linux_gateway_page, 30b-linux_gateway_page)1291ASM_EXCEPTIONTABLE_ENTRY(7b-linux_gateway_page, 30b-linux_gateway_page)12921293/* A page fault occurred in critical region */129431: b,n lws_pagefault1295ASM_EXCEPTIONTABLE_ENTRY(9b-linux_gateway_page, 31b-linux_gateway_page)1296ASM_EXCEPTIONTABLE_ENTRY(10b-linux_gateway_page, 31b-linux_gateway_page)1297ASM_EXCEPTIONTABLE_ENTRY(11b-linux_gateway_page, 31b-linux_gateway_page)1298ASM_EXCEPTIONTABLE_ENTRY(12b-linux_gateway_page, 31b-linux_gateway_page)1299ASM_EXCEPTIONTABLE_ENTRY(13b-linux_gateway_page, 31b-linux_gateway_page)1300ASM_EXCEPTIONTABLE_ENTRY(14b-linux_gateway_page, 31b-linux_gateway_page)1301ASM_EXCEPTIONTABLE_ENTRY(15b-linux_gateway_page, 31b-linux_gateway_page)1302ASM_EXCEPTIONTABLE_ENTRY(16b-linux_gateway_page, 31b-linux_gateway_page)13031304/* Make sure nothing else is placed on this page */1305.align PAGE_SIZE1306END(linux_gateway_page)1307ENTRY(end_linux_gateway_page)13081309/* Relocate symbols assuming linux_gateway_page is mapped1310to virtual address 0x0 */13111312#define LWS_ENTRY(_name_) ASM_ULONG_INSN (lws_##_name_ - linux_gateway_page)13131314.section .rodata,"a"13151316.align 81317/* Light-weight-syscall table */1318/* Start of lws table. */1319ENTRY(lws_table)1320LWS_ENTRY(compare_and_swap32) /* 0 - ELF32 Atomic 32bit CAS */1321LWS_ENTRY(compare_and_swap64) /* 1 - ELF64 Atomic 32bit CAS */1322LWS_ENTRY(compare_and_swap_2) /* 2 - Atomic 64bit CAS */1323LWS_ENTRY(atomic_xchg) /* 3 - Atomic Exchange */1324LWS_ENTRY(atomic_store) /* 4 - Atomic Store */1325END(lws_table)1326/* End of lws table */13271328#ifdef CONFIG_64BIT1329#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat)1330#else1331#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)1332#endif1333#define __SYSCALL(nr, entry) ASM_ULONG_INSN entry1334.align 81335ENTRY(sys_call_table)1336.export sys_call_table,data1337#include <asm/syscall_table_32.h> /* 32-bit syscalls */1338END(sys_call_table)13391340#ifdef CONFIG_64BIT1341#undef __SYSCALL_WITH_COMPAT1342#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native)1343.align 81344ENTRY(sys_call_table64)1345#include <asm/syscall_table_64.h> /* 64-bit syscalls */1346END(sys_call_table64)1347#endif13481349/*1350All light-weight-syscall atomic operations1351will use this set of locks13521353NOTE: The lws_lock_start symbol must be1354at least 16-byte aligned for safe use1355with ldcw.1356*/1357.section .data1358.align L1_CACHE_BYTES1359ENTRY(lws_lock_start)1360/* lws locks */1361.rept 2561362/* Keep locks aligned at 16-bytes */1363.word __ARCH_SPIN_LOCK_UNLOCKED_VAL1364.word 01365.word 01366.word 01367.endr1368END(lws_lock_start)1369.previous13701371.end137213731374