1 /* SunOS's execv() call only specifies the argv argument, the
2 * environment settings are the same as the calling processes.
13 set compat_sys_execve, %g1
20 ba,pt %xcc, sys_sparc_pipe_real
21 add %sp, PTREGS_OFF, %o0
23 ba,pt %xcc, c_sys_nis_syscall
24 add %sp, PTREGS_OFF, %o0
26 ba,pt %xcc, sparc_memory_ordering
27 add %sp, PTREGS_OFF, %o1
29 ba,pt %xcc, do_sigaltstack
30 add %i6, STACK_BIAS, %o2
33 ba,pt %xcc, do_sys32_sigstack
36 ba,pt %xcc, do_sys32_sigaltstack
42 add %sp, PTREGS_OFF, %o0
48 add %sp, PTREGS_OFF, %o0
54 add %sp, PTREGS_OFF, %o0
55 call do_rt_sigreturn32
60 1: ldx [%g6 + TI_FLAGS], %l5
61 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
64 call syscall_trace_leave
65 add %sp, PTREGS_OFF, %o0
69 /* This is how fork() was meant to be done, 8 instruction entry.
71 * I questioned the following code briefly, let me clear things
72 * up so you must not reason on it like I did.
74 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
75 * need it here because the only piece of window state we copy to
76 * the child is the CWP register. Even if the parent sleeps,
77 * we are safe because we stuck it into pt_regs of the parent
78 * so it will not change.
80 * XXX This raises the question, whether we can do the same on
81 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
82 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
83 * XXX fork_kwim in UREG_G1 (global registers are considered
84 * XXX volatile across a system call in the sparc ABI I think
85 * XXX if it isn't we can use regs->y instead, anyone who depends
86 * XXX upon the Y register being preserved across a fork deserves
89 * In fact we should take advantage of that fact for other things
90 * during system calls...
93 sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
94 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
95 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
104 ba,pt %xcc, sparc_do_fork
105 add %sp, PTREGS_OFF, %o2
107 .globl ret_from_syscall
109 /* Clear current_thread_info()->new_child. */
110 stb %g0, [%g6 + TI_NEW_CHILD]
113 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
114 brnz,pt %o0, ret_sys_call
115 ldx [%g6 + TI_FLAGS], %l0
116 ldx [%sp + PTREGS_OFF + PT_V9_G1], %l1
118 ldx [%sp + PTREGS_OFF + PT_V9_G2], %o0
119 ba,pt %xcc, ret_sys_call
123 .type sparc_exit,#function
126 wrpr %g2, PSTATE_IE, %pstate
130 wrpr %g3, 0x0, %cansave
131 wrpr %g0, 0x0, %otherwin
132 wrpr %g2, 0x0, %pstate
134 stb %g0, [%g6 + TI_WSAVED]
135 .size sparc_exit,.-sparc_exit
137 linux_sparc_ni_syscall:
138 sethi %hi(sys_ni_syscall), %l7
140 or %l7, %lo(sys_ni_syscall), %l7
142 linux_syscall_trace32:
143 call syscall_trace_enter
144 add %sp, PTREGS_OFF, %o0
155 call syscall_trace_enter
156 add %sp, PTREGS_OFF, %o0
167 /* Linux 32-bit system calls enter here... */
169 .globl linux_sparc_syscall32
170 linux_sparc_syscall32:
171 /* Direct access to user regs, much faster. */
172 cmp %g1, NR_syscalls ! IEU1 Group
173 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
174 srl %i0, 0, %o0 ! IEU0
175 sll %g1, 2, %l4 ! IEU0 Group
176 srl %i4, 0, %o4 ! IEU1
177 lduw [%l7 + %l4], %l7 ! Load
178 srl %i1, 0, %o1 ! IEU0 Group
179 ldx [%g6 + TI_FLAGS], %l0 ! Load
181 srl %i5, 0, %o5 ! IEU1
182 srl %i2, 0, %o2 ! IEU0 Group
183 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
184 bne,pn %icc, linux_syscall_trace32 ! CTI
186 call %l7 ! CTI Group brk forced
187 srl %i3, 0, %o3 ! IEU0
190 /* Linux native system calls enter here... */
192 .globl linux_sparc_syscall
194 /* Direct access to user regs, much faster. */
195 cmp %g1, NR_syscalls ! IEU1 Group
196 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
198 sll %g1, 2, %l4 ! IEU0 Group
200 lduw [%l7 + %l4], %l7 ! Load
201 4: mov %i2, %o2 ! IEU0 Group
202 ldx [%g6 + TI_FLAGS], %l0 ! Load
205 mov %i4, %o4 ! IEU0 Group
206 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
207 bne,pn %icc, linux_syscall_trace ! CTI Group
209 2: call %l7 ! CTI Group brk forced
213 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
215 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
217 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
220 cmp %o0, -ERESTART_RESTARTBLOCK
222 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
223 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
226 /* System call success, clear Carry condition code. */
229 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
230 bne,pn %icc, linux_syscall_trace2
231 add %l1, 0x4, %l2 ! npc = npc+4
232 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
234 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
237 /* Check if force_successful_syscall_return()
240 ldub [%g6 + TI_SYS_NOERROR], %l2
242 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
243 /* System call failure, set Carry condition code.
244 * Also, get abs(errno) to return to the process.
247 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
251 linux_syscall_trace2:
252 call syscall_trace_leave
253 add %sp, PTREGS_OFF, %o0
254 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
256 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]