- Alan Cox: synch. PA-RISC arch and bitops cleanups
[davej-history.git] / arch / parisc / hpux / gate.S
blob5e0bf3c663ad975f026c6e348df54eb09af50c96
1 /* ------------------------------------------------------------------------------
2  *
3  * Linux/PARISC Project (http://www.thepuffingroup.com/parisc)
4  *
5  * System call entry code Copyright (c) Matthew Wilcox 1999 <willy@bofh.ai>
6  * Licensed under the GNU GPL.
7  * thanks to Philipp Rumpf, Mike Shaver and various others
8  * sorry about the wall, puffin..
9  */
11 #define __ASSEMBLY__
12 #include <asm/assembly.h>
13 #include <asm/offset.h>
14 #include <asm/unistd.h>
15 #include <asm/errno.h>
16 #define __ASSEMBLY__
17 #include <asm/assembly.h>       /* for STREG/LDREG */
19         .text
21         .import hpux_call_table
22         .import hpux_syscall_exit,code
23         .export hpux_gateway_page
25         .align 4096
26 hpux_gateway_page:
27         nop
28         mfsp    %sr7,%r1                        ;! we must set sr3 to the space
29         mtsp    %r1,%sr3                        ;! of the user before the gate
30 #ifdef __LP64__
31 #warning NEEDS WORK for 64-bit
32 #endif
33         ldw     -64(%r30), %r28                 ;! 8th argument
34         ldw     -60(%r30), %r19                 ;! 7th argument
35         ldw     -56(%r30), %r20                 ;! 6th argument
36         ldw     -52(%r30), %r21                 ;! 5th argument
37         gate    .+8, %r0                        ;! become privileged
38         mtsp    %r0,%sr4                        ;! get kernel space into sr4
39         mtsp    %r0,%sr5                        ;! get kernel space into sr5
40         mtsp    %r0,%sr6                        ;! get kernel space into sr6
41         mtsp    %r0,%sr7                        ;! get kernel space into sr7
42         mfctl   %cr30,%r1                       ;! get the kernel task ptr
43         mtctl   %r0,%cr30                       ;! zero it (flag)
44         STREG   %r30,TASK_PT_GR30(%r1)          ;! preserve userspace sp
45         STREG   %r2,TASK_PT_GR2(%r1)            ;! preserve rp
46         STREG   %r27,TASK_PT_GR27(%r1)          ;! user dp
47         STREG   %r31,TASK_PT_GR31(%r1)          ;! preserve syscall return ptr
49         loadgp                                  ;! setup kernel dp
51         ldo     TASK_SZ_ALGN+64(%r1),%r30       ;! set up kernel stack
53         stw     %r21, -52(%r30)                 ;! 5th argument
54         stw     %r20, -56(%r30)                 ;! 6th argument
55         stw     %r19, -60(%r30)                 ;! 7th argument
56         stw     %r28, -64(%r30)                 ;! 8th argument
58         ldil    L%hpux_call_table, %r21
59         ldo     R%hpux_call_table(%r21), %r21
60         comiclr,>>=     __NR_HPUX_syscalls, %r22, %r0
61         b,n     syscall_nosys
62         ldwx,s  %r22(%r21), %r21
63         ldil    L%hpux_syscall_exit,%r2
64         be      0(%sr7,%r21)
65         ldo     R%hpux_syscall_exit(%r2),%r2
67 syscall_nosys:
68         ldil    L%hpux_syscall_exit,%r1
69         be      R%hpux_syscall_exit(%sr7,%r1)
70         ldo     -ENOSYS(%r0),%r28
72         .align 4096
73         .export end_hpux_gateway_page
74 end_hpux_gateway_page: