/*1*2* Linux/PARISC Project (http://www.parisc-linux.org/)3*4* System call entry code 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#include <asm/assembly.h>11#include <asm/asm-offsets.h>12#include <asm/unistd.h>13#include <asm/errno.h>14#include <linux/linkage.h>1516.level LEVEL17.text1819.import hpux_call_table20.import hpux_syscall_exit,code2122.align PAGE_SIZE23ENTRY(hpux_gateway_page)24nop25#ifdef CONFIG_64BIT26#warning NEEDS WORK for 64-bit27#endif28ldw -64(%r30), %r29 ;! 8th argument29ldw -60(%r30), %r19 ;! 7th argument30ldw -56(%r30), %r20 ;! 6th argument31ldw -52(%r30), %r21 ;! 5th argument32gate .+8, %r0 /* become privileged */33mtsp %r0,%sr4 /* get kernel space into sr4 */34mtsp %r0,%sr5 /* get kernel space into sr5 */35mtsp %r0,%sr6 /* get kernel space into sr6 */36mfsp %sr7,%r1 /* save user sr7 */37mtsp %r1,%sr3 /* and store it in sr3 */3839mtctl %r30,%cr2840mfctl %cr30,%r141xor %r1,%r30,%r30 /* ye olde xor trick */42xor %r1,%r30,%r143xor %r1,%r30,%r3044ldo TASK_SZ_ALGN+FRAME_SIZE(%r30),%r30 /* set up kernel stack */4546/* N.B.: It is critical that we don't set sr7 to 0 until r3047* contains a valid kernel stack pointer. It is also48* critical that we don't start using the kernel stack49* until after sr7 has been set to 0.50*/5152mtsp %r0,%sr7 /* get kernel space into sr7 */53STREG %r1,TASK_PT_GR30-TASK_SZ_ALGN-FRAME_SIZE(%r30) /* save usp */54ldo -TASK_SZ_ALGN-FRAME_SIZE(%r30),%r1 /* get task ptr in %r1 */5556/* Save some registers for sigcontext and potential task57switch (see entry.S for the details of which ones are58saved/restored). TASK_PT_PSW is zeroed so we can see whether59a process is on a syscall or not. For an interrupt the real60PSW value is stored. This is needed for gdb and sys_ptrace. */61STREG %r0, TASK_PT_PSW(%r1)62STREG %r2, TASK_PT_GR2(%r1) /* preserve rp */63STREG %r19, TASK_PT_GR19(%r1) /* 7th argument */64STREG %r20, TASK_PT_GR20(%r1) /* 6th argument */65STREG %r21, TASK_PT_GR21(%r1) /* 5th argument */66STREG %r22, TASK_PT_GR22(%r1) /* syscall # */67STREG %r23, TASK_PT_GR23(%r1) /* 4th argument */68STREG %r24, TASK_PT_GR24(%r1) /* 3rd argument */69STREG %r25, TASK_PT_GR25(%r1) /* 2nd argument */70STREG %r26, TASK_PT_GR26(%r1) /* 1st argument */71STREG %r27, TASK_PT_GR27(%r1) /* user dp */72STREG %r28, TASK_PT_GR28(%r1) /* return value 0 */73STREG %r28, TASK_PT_ORIG_R28(%r1) /* return value 0 (saved for signals) */74STREG %r29, TASK_PT_GR29(%r1) /* 8th argument */75STREG %r31, TASK_PT_GR31(%r1) /* preserve syscall return ptr */7677ldo TASK_PT_FR0(%r1), %r27 /* save fpregs from the kernel */78save_fp %r27 /* or potential task switch */7980mfctl %cr11, %r27 /* i.e. SAR */81STREG %r27, TASK_PT_SAR(%r1)8283loadgp8485stw %r21, -52(%r30) ;! 5th argument86stw %r20, -56(%r30) ;! 6th argument87stw %r19, -60(%r30) ;! 7th argument88stw %r29, -64(%r30) ;! 8th argument8990ldil L%hpux_call_table, %r2191ldo R%hpux_call_table(%r21), %r2192comiclr,>>= __NR_HPUX_syscalls, %r22, %r093b,n syscall_nosys94LDREGX %r22(%r21), %r2195ldil L%hpux_syscall_exit,%r296be 0(%sr7,%r21)97ldo R%hpux_syscall_exit(%r2),%r29899syscall_nosys:100ldil L%hpux_syscall_exit,%r1101be R%hpux_syscall_exit(%sr7,%r1)102ldo -ENOSYS(%r0),%r28103ENDPROC(hpux_gateway_page)104105.align PAGE_SIZE106ENTRY(end_hpux_gateway_page)107108109