1 /* SunOS's execv() call only specifies the argv argument, the
2 * environment settings are the same as the calling processes.
5 sethi %hi(sparc_execve), %g1
6 ba,pt %xcc, execve_merge
7 or %g1, %lo(sparc_execve), %g1
11 stx %g0, [%sp + PTREGS_OFF + PT_V9_I2]
13 sethi %hi(sparc32_execve), %g1
14 or %g1, %lo(sparc32_execve), %g1
20 add %sp, PTREGS_OFF, %o0
24 ba,pt %xcc, sys_sparc_pipe_real
25 add %sp, PTREGS_OFF, %o0
27 ba,pt %xcc, c_sys_nis_syscall
28 add %sp, PTREGS_OFF, %o0
30 ba,pt %xcc, sparc_memory_ordering
31 add %sp, PTREGS_OFF, %o1
33 ba,pt %xcc, do_sigaltstack
34 add %i6, STACK_BIAS, %o2
37 ba,pt %xcc, do_sys32_sigstack
40 ba,pt %xcc, do_sys32_sigaltstack
46 add %sp, PTREGS_OFF, %o0
52 add %sp, PTREGS_OFF, %o0
58 add %sp, PTREGS_OFF, %o0
59 call do_rt_sigreturn32
64 1: ldx [%g6 + TI_FLAGS], %l5
65 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
68 add %sp, PTREGS_OFF, %o0
74 /* This is how fork() was meant to be done, 8 instruction entry.
76 * I questioned the following code briefly, let me clear things
77 * up so you must not reason on it like I did.
79 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
80 * need it here because the only piece of window state we copy to
81 * the child is the CWP register. Even if the parent sleeps,
82 * we are safe because we stuck it into pt_regs of the parent
83 * so it will not change.
85 * XXX This raises the question, whether we can do the same on
86 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
87 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
88 * XXX fork_kwim in UREG_G1 (global registers are considered
89 * XXX volatile across a system call in the sparc ABI I think
90 * XXX if it isn't we can use regs->y instead, anyone who depends
91 * XXX upon the Y register being preserved across a fork deserves
94 * In fact we should take advantage of that fact for other things
95 * during system calls...
98 sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
99 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
100 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
101 ba,pt %xcc, sys_clone
109 ba,pt %xcc, sparc_do_fork
110 add %sp, PTREGS_OFF, %o2
112 .globl ret_from_syscall
114 /* Clear current_thread_info()->new_child, and
115 * check performance counter stuff too.
117 stb %g0, [%g6 + TI_NEW_CHILD]
118 ldx [%g6 + TI_FLAGS], %l0
121 andcc %l0, _TIF_PERFCTR, %g0
124 ldx [%g6 + TI_PCR], %o7
127 /* Blackbird errata workaround. See commentary in
128 * smp.c:smp_percpu_timer_interrupt() for more
135 99: wr %g0, %g0, %pic
138 1: ba,pt %xcc, ret_sys_call
139 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
142 .type sparc_exit,#function
145 wrpr %g2, PSTATE_IE, %pstate
149 wrpr %g3, 0x0, %cansave
150 wrpr %g0, 0x0, %otherwin
151 wrpr %g2, 0x0, %pstate
153 stb %g0, [%g6 + TI_WSAVED]
154 .size sparc_exit,.-sparc_exit
156 linux_sparc_ni_syscall:
157 sethi %hi(sys_ni_syscall), %l7
159 or %l7, %lo(sys_ni_syscall), %l7
161 linux_syscall_trace32:
162 add %sp, PTREGS_OFF, %o0
175 add %sp, PTREGS_OFF, %o0
188 /* Linux 32-bit system calls enter here... */
190 .globl linux_sparc_syscall32
191 linux_sparc_syscall32:
192 /* Direct access to user regs, much faster. */
193 cmp %g1, NR_SYSCALLS ! IEU1 Group
194 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
195 srl %i0, 0, %o0 ! IEU0
196 sll %g1, 2, %l4 ! IEU0 Group
197 srl %i4, 0, %o4 ! IEU1
198 lduw [%l7 + %l4], %l7 ! Load
199 srl %i1, 0, %o1 ! IEU0 Group
200 ldx [%g6 + TI_FLAGS], %l0 ! Load
202 srl %i5, 0, %o5 ! IEU1
203 srl %i2, 0, %o2 ! IEU0 Group
204 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
205 bne,pn %icc, linux_syscall_trace32 ! CTI
207 call %l7 ! CTI Group brk forced
208 srl %i3, 0, %o3 ! IEU0
211 /* Linux native system calls enter here... */
213 .globl linux_sparc_syscall
215 /* Direct access to user regs, much faster. */
216 cmp %g1, NR_SYSCALLS ! IEU1 Group
217 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
219 sll %g1, 2, %l4 ! IEU0 Group
221 lduw [%l7 + %l4], %l7 ! Load
222 4: mov %i2, %o2 ! IEU0 Group
223 ldx [%g6 + TI_FLAGS], %l0 ! Load
226 mov %i4, %o4 ! IEU0 Group
227 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
228 bne,pn %icc, linux_syscall_trace ! CTI Group
230 2: call %l7 ! CTI Group brk forced
234 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
236 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
237 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
239 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
242 /* Check if force_successful_syscall_return()
245 ldub [%g6 + TI_SYS_NOERROR], %l2
247 stb %g0, [%g6 + TI_SYS_NOERROR]
249 cmp %o0, -ERESTART_RESTARTBLOCK
251 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
253 /* System call success, clear Carry condition code. */
255 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
256 bne,pn %icc, linux_syscall_trace2
257 add %l1, 0x4, %l2 ! npc = npc+4
258 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
260 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
263 /* System call failure, set Carry condition code.
264 * Also, get abs(errno) to return to the process.
266 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
269 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
270 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
271 bne,pn %icc, linux_syscall_trace2
272 add %l1, 0x4, %l2 ! npc = npc+4
273 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
276 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
277 linux_syscall_trace2:
278 add %sp, PTREGS_OFF, %o0
281 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
283 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]