GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / sparc / kernel / syscalls.S
blob15ac08dc6899ecd84f32c653ac61e38a3480550f
1         /* SunOS's execv() call only specifies the argv argument, the
2          * environment settings are the same as the calling processes.
3          */
4 sys_execve:
5         sethi   %hi(sparc_execve), %g1
6         ba,pt   %xcc, execve_merge
7          or     %g1, %lo(sparc_execve), %g1
9 #ifdef CONFIG_COMPAT
10 sunos_execv:
11         stx     %g0, [%sp + PTREGS_OFF + PT_V9_I2]
12 sys32_execve:
13         sethi   %hi(sparc32_execve), %g1
14         or      %g1, %lo(sparc32_execve), %g1
15 #endif
17 execve_merge:
18         flushw
19         jmpl    %g1, %g0
20          add    %sp, PTREGS_OFF, %o0
22         .align  32
23 sys_sparc_pipe:
24         ba,pt   %xcc, sys_sparc_pipe_real
25          add    %sp, PTREGS_OFF, %o0
26 sys_nis_syscall:
27         ba,pt   %xcc, c_sys_nis_syscall
28          add    %sp, PTREGS_OFF, %o0
29 sys_memory_ordering:
30         ba,pt   %xcc, sparc_memory_ordering
31          add    %sp, PTREGS_OFF, %o1
32 sys_sigaltstack:
33         ba,pt   %xcc, do_sigaltstack
34          add    %i6, STACK_BIAS, %o2
35 #ifdef CONFIG_COMPAT
36 sys32_sigstack:
37         ba,pt   %xcc, do_sys32_sigstack
38          mov    %i6, %o2
39 sys32_sigaltstack:
40         ba,pt   %xcc, do_sys32_sigaltstack
41          mov    %i6, %o2
42 #endif
43         .align  32
44 #ifdef CONFIG_COMPAT
45 sys32_sigreturn:
46         add     %sp, PTREGS_OFF, %o0
47         call    do_sigreturn32
48          add    %o7, 1f-.-4, %o7
49         nop
50 #endif
51 sys_rt_sigreturn:
52         add     %sp, PTREGS_OFF, %o0
53         call    do_rt_sigreturn
54          add    %o7, 1f-.-4, %o7
55         nop
56 #ifdef CONFIG_COMPAT
57 sys32_rt_sigreturn:
58         add     %sp, PTREGS_OFF, %o0
59         call    do_rt_sigreturn32
60          add    %o7, 1f-.-4, %o7
61         nop
62 #endif
63         .align  32
64 1:      ldx     [%g6 + TI_FLAGS], %l5
65         andcc   %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
66         be,pt   %icc, rtrap
67          nop
68         call    syscall_trace_leave
69          add    %sp, PTREGS_OFF, %o0
70         ba,pt   %xcc, rtrap
71          nop
73         .align  32
74 sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
75         sethi   %hi(0x4000 | 0x0100 | SIGCHLD), %o0
76         or      %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
77         ba,pt   %xcc, sys_clone
78 sys_fork:
79          clr    %o1
80         mov     SIGCHLD, %o0
81 sys_clone:
82         flushw
83         movrz   %o1, %fp, %o1
84         mov     0, %o3
85         ba,pt   %xcc, sparc_do_fork
86          add    %sp, PTREGS_OFF, %o2
88         .globl  ret_from_syscall
89 ret_from_syscall:
90         /* Clear current_thread_info()->new_child. */
91         stb     %g0, [%g6 + TI_NEW_CHILD]
92         ldx     [%g6 + TI_FLAGS], %l0
93         call    schedule_tail
94          mov    %g7, %o0
95         ba,pt   %xcc, ret_sys_call
96          ldx    [%sp + PTREGS_OFF + PT_V9_I0], %o0
98         .globl  sparc_exit
99         .type   sparc_exit,#function
100 sparc_exit:
101         rdpr    %pstate, %g2
102         wrpr    %g2, PSTATE_IE, %pstate
103         rdpr    %otherwin, %g1
104         rdpr    %cansave, %g3
105         add     %g3, %g1, %g3
106         wrpr    %g3, 0x0, %cansave
107         wrpr    %g0, 0x0, %otherwin
108         wrpr    %g2, 0x0, %pstate
109         ba,pt   %xcc, sys_exit
110          stb    %g0, [%g6 + TI_WSAVED]
111         .size   sparc_exit,.-sparc_exit
113 linux_sparc_ni_syscall:
114         sethi   %hi(sys_ni_syscall), %l7
115         ba,pt   %xcc, 4f
116          or     %l7, %lo(sys_ni_syscall), %l7
118 linux_syscall_trace32:
119         call    syscall_trace_enter
120          add    %sp, PTREGS_OFF, %o0
121         brnz,pn %o0, 3f
122          mov    -ENOSYS, %o0
123         srl     %i0, 0, %o0
124         srl     %i4, 0, %o4
125         srl     %i1, 0, %o1
126         srl     %i2, 0, %o2
127         ba,pt   %xcc, 2f
128          srl    %i3, 0, %o3
130 linux_syscall_trace:
131         call    syscall_trace_enter
132          add    %sp, PTREGS_OFF, %o0
133         brnz,pn %o0, 3f
134          mov    -ENOSYS, %o0
135         mov     %i0, %o0
136         mov     %i1, %o1
137         mov     %i2, %o2
138         mov     %i3, %o3
139         b,pt    %xcc, 2f
140          mov    %i4, %o4
143         /* Linux 32-bit system calls enter here... */
144         .align  32
145         .globl  linux_sparc_syscall32
146 linux_sparc_syscall32:
147         /* Direct access to user regs, much faster. */
148         cmp     %g1, NR_syscalls                        ! IEU1  Group
149         bgeu,pn %xcc, linux_sparc_ni_syscall            ! CTI
150          srl    %i0, 0, %o0                             ! IEU0
151         sll     %g1, 2, %l4                             ! IEU0  Group
152         srl     %i4, 0, %o4                             ! IEU1
153         lduw    [%l7 + %l4], %l7                        ! Load
154         srl     %i1, 0, %o1                             ! IEU0  Group
155         ldx     [%g6 + TI_FLAGS], %l0           ! Load
157         srl     %i5, 0, %o5                             ! IEU1
158         srl     %i2, 0, %o2                             ! IEU0  Group
159         andcc   %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
160         bne,pn  %icc, linux_syscall_trace32             ! CTI
161          mov    %i0, %l5                                ! IEU1
162         call    %l7                                     ! CTI   Group brk forced
163          srl    %i3, 0, %o3                             ! IEU0
164         ba,a,pt %xcc, 3f
166         /* Linux native system calls enter here... */
167         .align  32
168         .globl  linux_sparc_syscall
169 linux_sparc_syscall:
170         /* Direct access to user regs, much faster. */
171         cmp     %g1, NR_syscalls                        ! IEU1  Group
172         bgeu,pn %xcc, linux_sparc_ni_syscall            ! CTI
173          mov    %i0, %o0                                ! IEU0
174         sll     %g1, 2, %l4                             ! IEU0  Group
175         mov     %i1, %o1                                ! IEU1
176         lduw    [%l7 + %l4], %l7                        ! Load
177 4:      mov     %i2, %o2                                ! IEU0  Group
178         ldx     [%g6 + TI_FLAGS], %l0           ! Load
180         mov     %i3, %o3                                ! IEU1
181         mov     %i4, %o4                                ! IEU0  Group
182         andcc   %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
183         bne,pn  %icc, linux_syscall_trace               ! CTI   Group
184          mov    %i0, %l5                                ! IEU0
185 2:      call    %l7                                     ! CTI   Group brk forced
186          mov    %i5, %o5                                ! IEU0
187         nop
189 3:      stx     %o0, [%sp + PTREGS_OFF + PT_V9_I0]
190 ret_sys_call:
191         ldx     [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
192         ldx     [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
193         sra     %o0, 0, %o0
194         mov     %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
195         sllx    %g2, 32, %g2
197         /* Check if force_successful_syscall_return()
198          * was invoked.
199          */
200         ldub    [%g6 + TI_SYS_NOERROR], %l2
201         brnz,a,pn %l2, 80f
202          stb    %g0, [%g6 + TI_SYS_NOERROR]
204         cmp     %o0, -ERESTART_RESTARTBLOCK
205         bgeu,pn %xcc, 1f
206          andcc  %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
208         /* System call success, clear Carry condition code. */
209         andn    %g3, %g2, %g3
210         stx     %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]  
211         bne,pn  %icc, linux_syscall_trace2
212          add    %l1, 0x4, %l2                   ! npc = npc+4
213         stx     %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
214         ba,pt   %xcc, rtrap
215          stx    %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
218         /* System call failure, set Carry condition code.
219          * Also, get abs(errno) to return to the process.
220          */
221         andcc   %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6  
222         sub     %g0, %o0, %o0
223         or      %g3, %g2, %g3
224         stx     %o0, [%sp + PTREGS_OFF + PT_V9_I0]
225         stx     %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
226         bne,pn  %icc, linux_syscall_trace2
227          add    %l1, 0x4, %l2                   ! npc = npc+4
228         stx     %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
230         b,pt    %xcc, rtrap
231          stx    %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
232 linux_syscall_trace2:
233         call    syscall_trace_leave
234          add    %sp, PTREGS_OFF, %o0
235         stx     %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
236         ba,pt   %xcc, rtrap
237          stx    %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]