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
30 ba,pt %xcc, do_sys32_sigstack
36 add %sp, PTREGS_OFF, %o0
42 add %sp, PTREGS_OFF, %o0
48 add %sp, PTREGS_OFF, %o0
49 call do_rt_sigreturn32
54 1: ldx [%g6 + TI_FLAGS], %l5
55 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
58 call syscall_trace_leave
59 add %sp, PTREGS_OFF, %o0
63 /* This is how fork() was meant to be done, 8 instruction entry.
65 * I questioned the following code briefly, let me clear things
66 * up so you must not reason on it like I did.
68 * Know the fork_kpsr etc. we use in the sparc32 port? We don't
69 * need it here because the only piece of window state we copy to
70 * the child is the CWP register. Even if the parent sleeps,
71 * we are safe because we stuck it into pt_regs of the parent
72 * so it will not change.
74 * XXX This raises the question, whether we can do the same on
75 * XXX sparc32 to get rid of fork_kpsr _and_ fork_kwim. The
76 * XXX answer is yes. We stick fork_kpsr in UREG_G0 and
77 * XXX fork_kwim in UREG_G1 (global registers are considered
78 * XXX volatile across a system call in the sparc ABI I think
79 * XXX if it isn't we can use regs->y instead, anyone who depends
80 * XXX upon the Y register being preserved across a fork deserves
83 * In fact we should take advantage of that fact for other things
84 * during system calls...
87 sys_vfork: /* Under Linux, vfork and fork are just special cases of clone. */
88 sethi %hi(0x4000 | 0x0100 | SIGCHLD), %o0
89 or %o0, %lo(0x4000 | 0x0100 | SIGCHLD), %o0
98 ba,pt %xcc, sparc_do_fork
99 add %sp, PTREGS_OFF, %o2
101 .globl ret_from_syscall
103 /* Clear current_thread_info()->new_child. */
104 stb %g0, [%g6 + TI_NEW_CHILD]
107 ldx [%sp + PTREGS_OFF + PT_V9_I0], %o0
108 brnz,pt %o0, ret_sys_call
109 ldx [%g6 + TI_FLAGS], %l0
110 ldx [%sp + PTREGS_OFF + PT_V9_G1], %l1
112 ldx [%sp + PTREGS_OFF + PT_V9_G2], %o0
113 ba,pt %xcc, ret_sys_call
116 .globl sparc_exit_group
117 .type sparc_exit_group,#function
119 sethi %hi(sys_exit_group), %g7
121 or %g7, %lo(sys_exit_group), %g7
122 .size sparc_exit_group,.-sparc_exit_group
125 .type sparc_exit,#function
127 sethi %hi(sys_exit), %g7
128 or %g7, %lo(sys_exit), %g7
130 wrpr %g2, PSTATE_IE, %pstate
134 wrpr %g3, 0x0, %cansave
135 wrpr %g0, 0x0, %otherwin
136 wrpr %g2, 0x0, %pstate
138 stb %g0, [%g6 + TI_WSAVED]
139 .size sparc_exit,.-sparc_exit
141 linux_sparc_ni_syscall:
142 sethi %hi(sys_ni_syscall), %l7
144 or %l7, %lo(sys_ni_syscall), %l7
146 linux_syscall_trace32:
147 call syscall_trace_enter
148 add %sp, PTREGS_OFF, %o0
159 call syscall_trace_enter
160 add %sp, PTREGS_OFF, %o0
171 /* Linux 32-bit system calls enter here... */
173 .globl linux_sparc_syscall32
174 linux_sparc_syscall32:
175 /* Direct access to user regs, much faster. */
176 cmp %g1, NR_syscalls ! IEU1 Group
177 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
178 srl %i0, 0, %o0 ! IEU0
179 sll %g1, 2, %l4 ! IEU0 Group
180 srl %i4, 0, %o4 ! IEU1
181 lduw [%l7 + %l4], %l7 ! Load
182 srl %i1, 0, %o1 ! IEU0 Group
183 ldx [%g6 + TI_FLAGS], %l0 ! Load
185 srl %i5, 0, %o5 ! IEU1
186 srl %i2, 0, %o2 ! IEU0 Group
187 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
188 bne,pn %icc, linux_syscall_trace32 ! CTI
190 call %l7 ! CTI Group brk forced
191 srl %i3, 0, %o3 ! IEU0
194 /* Linux native system calls enter here... */
196 .globl linux_sparc_syscall
198 /* Direct access to user regs, much faster. */
199 cmp %g1, NR_syscalls ! IEU1 Group
200 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
202 sll %g1, 2, %l4 ! IEU0 Group
204 lduw [%l7 + %l4], %l7 ! Load
205 4: mov %i2, %o2 ! IEU0 Group
206 ldx [%g6 + TI_FLAGS], %l0 ! Load
209 mov %i4, %o4 ! IEU0 Group
210 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
211 bne,pn %icc, linux_syscall_trace ! CTI Group
213 2: call %l7 ! CTI Group brk forced
217 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
219 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
221 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
224 cmp %o0, -ERESTART_RESTARTBLOCK
226 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
227 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
230 /* System call success, clear Carry condition code. */
233 stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
234 bne,pn %icc, linux_syscall_trace2
235 add %l1, 0x4, %l2 ! npc = npc+4
236 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
238 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
241 /* Check if force_successful_syscall_return()
244 ldub [%g6 + TI_SYS_NOERROR], %l2
246 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
247 /* System call failure, set Carry condition code.
248 * Also, get abs(errno) to return to the process.
251 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
255 linux_syscall_trace2:
256 call syscall_trace_leave
257 add %sp, PTREGS_OFF, %o0
258 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
260 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]