1 #include <asm/asmmacro.h>
3 #include <asm/asm-offsets.h>
4 #include <asm/signal.h>
5 #include <asm/thread_info.h>
7 #include "../kernel/minstate.h"
10 * execve() is special because in case of success, we need to
11 * setup a null register window frame (in case an IA-32 process
12 * is exec'ing an IA-64 program).
15 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(3)
16 alloc loc1=ar.pfs,3,2,4,0
19 zxt4 out0=in0 // filename
20 ;; // stop bit between alloc and call
23 add out3=16,sp // regs
24 br.call.sptk.few rp=sys32_execve
26 mov ar.pfs=loc1 // restore ar.pfs
28 (p6) mov ar.pfs=r0 // clear ar.pfs in case of success
29 sxt4 r8=r8 // return 64-bit result
35 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(5)
36 alloc r16=ar.pfs,5,2,6,0
39 mov loc1=r16 // save ar.pfs across do_fork
41 zxt4 out1=in1 // newsp
42 mov out3=16 // stacksize (compensates for 16-byte scratch area)
43 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s
44 mov out0=in0 // out0 = clone_flags
45 zxt4 out4=in2 // out4 = parent_tidptr
46 zxt4 out5=in4 // out5 = child_tidptr
47 br.call.sptk.many rp=do_fork
49 adds sp=IA64_SWITCH_STACK_SIZE,sp // pop the switch stack
55 GLOBAL_ENTRY(ia32_ret_from_clone)
56 PT_REGS_UNWIND_INFO(0)
58 * Some versions of gas generate bad unwind info if the first instruction of a
59 * procedure doesn't go into the first slot of a bundle. This is a workaround.
64 * We need to call schedule_tail() to complete the scheduling process.
65 * Called by ia64_switch_to after do_fork()->copy_thread(). r8 contains the
66 * address of the previously executing task.
68 br.call.sptk.many rp=ia64_invoke_schedule_tail
71 adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
76 and r2=_TIF_SYSCALL_TRACEAUDIT,r2
79 (p6) br.cond.spnt .ia32_strace_check_retval
80 ;; // prevent RAW on r8
81 END(ia32_ret_from_clone)
83 GLOBAL_ENTRY(ia32_ret_from_syscall)
84 PT_REGS_UNWIND_INFO(0)
86 cmp.ge p6,p7=r8,r0 // syscall executed successfully?
87 adds r2=IA64_PT_REGS_R8_OFFSET+16,sp // r2 = &pt_regs.r8
89 alloc r3=ar.pfs,0,0,0,0 // drop the syscall argument frame
90 st8 [r2]=r8 // store return value in slot for r8
91 br.cond.sptk.many ia64_leave_kernel
92 END(ia32_ret_from_syscall)
95 // Invoke a system call, but do some tracing before and after the call.
96 // We MUST preserve the current register frame throughout this routine
97 // because some system calls (such as ia64_execve) directly
101 // r8 = syscall number
102 // b6 = syscall entry point
104 GLOBAL_ENTRY(ia32_trace_syscall)
105 PT_REGS_UNWIND_INFO(0)
107 adds r2=IA64_PT_REGS_R8_OFFSET+16,sp
109 st8 [r2]=r3 // initialize return code to -ENOSYS
110 br.call.sptk.few rp=syscall_trace_enter // give parent a chance to catch syscall args
111 .ret2: // Need to reload arguments (they may be changed by the tracing process)
112 adds r2=IA64_PT_REGS_R1_OFFSET+16,sp // r2 = &pt_regs.r1
113 adds r3=IA64_PT_REGS_R13_OFFSET+16,sp // r3 = &pt_regs.r13
114 mov r15=IA32_NR_syscalls
116 ld4 r8=[r2],IA64_PT_REGS_R9_OFFSET-IA64_PT_REGS_R1_OFFSET
117 movl r16=ia32_syscall_table
119 ld4 r33=[r2],8 // r9 == ecx
120 ld4 r37=[r3],16 // r13 == ebp
121 cmp.ltu.unc p6,p7=r8,r15
123 ld4 r34=[r2],8 // r10 == edx
124 ld4 r36=[r3],8 // r15 == edi
125 (p6) shladd r16=r8,3,r16 // force ni_syscall if not valid syscall number
129 ld4 r32=[r2],8 // r11 == ebx
131 ld4 r35=[r3],8 // r14 == esi
132 br.call.sptk.few rp=b6 // do the syscall
133 .ia32_strace_check_retval:
134 cmp.lt p6,p0=r8,r0 // syscall failed?
135 adds r2=IA64_PT_REGS_R8_OFFSET+16,sp // r2 = &pt_regs.r8
137 st8.spill [r2]=r8 // store return value in slot for r8
138 br.call.sptk.few rp=syscall_trace_leave // give parent a chance to catch return value
139 .ret4: alloc r2=ar.pfs,0,0,0,0 // drop the syscall argument frame
140 br.cond.sptk.many ia64_leave_kernel
141 END(ia32_trace_syscall)
143 GLOBAL_ENTRY(sys32_vfork)
144 alloc r16=ar.pfs,2,2,4,0;;
145 mov out0=IA64_CLONE_VFORK|IA64_CLONE_VM|SIGCHLD // out0 = clone_flags
146 br.cond.sptk.few .fork1 // do the work
149 GLOBAL_ENTRY(sys32_fork)
150 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
151 alloc r16=ar.pfs,2,2,4,0
152 mov out0=SIGCHLD // out0 = clone_flags
156 mov loc1=r16 // save ar.pfs across do_fork
163 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s
164 br.call.sptk.few rp=do_fork
166 adds sp=IA64_SWITCH_STACK_SIZE,sp // pop the switch stack
174 .globl ia32_syscall_table
176 data8 sys_ni_syscall /* 0 - old "setup(" system call*/
181 data8 compat_sys_open /* 5 */
186 data8 sys_unlink /* 10 */
189 data8 compat_sys_time
191 data8 sys_chmod /* 15 */
192 data8 sys_lchown /* 16-bit version */
193 data8 sys_ni_syscall /* old break syscall holder */
196 data8 sys_getpid /* 20 */
197 data8 compat_sys_mount
199 data8 sys_setuid /* 16-bit version */
200 data8 sys_getuid /* 16-bit version */
201 data8 compat_sys_stime /* 25 */
206 data8 compat_sys_utime /* 30 */
207 data8 sys_ni_syscall /* old stty syscall holder */
208 data8 sys_ni_syscall /* old gtty syscall holder */
211 data8 sys_ni_syscall /* 35 */ /* old ftime syscall holder */
216 data8 sys_rmdir /* 40 */
219 data8 compat_sys_times
220 data8 sys_ni_syscall /* old prof syscall holder */
221 data8 sys32_brk /* 45 */
222 data8 sys_setgid /* 16-bit version */
223 data8 sys_getgid /* 16-bit version */
225 data8 sys_geteuid /* 16-bit version */
226 data8 sys_getegid /* 16-bit version */ /* 50 */
228 data8 sys_umount /* recycled never used phys( */
229 data8 sys_ni_syscall /* old lock syscall holder */
230 data8 compat_sys_ioctl
231 data8 compat_sys_fcntl /* 55 */
232 data8 sys_ni_syscall /* old mpx syscall holder */
234 data8 sys_ni_syscall /* old ulimit syscall holder */
236 data8 sys_umask /* 60 */
241 data8 sys_getpgrp /* 65 */
243 data8 sys32_sigaction
246 data8 sys_setreuid /* 16-bit version */ /* 70 */
247 data8 sys_setregid /* 16-bit version */
248 data8 sys32_sigsuspend
249 data8 compat_sys_sigpending
250 data8 sys_sethostname
251 data8 compat_sys_setrlimit /* 75 */
252 data8 compat_sys_old_getrlimit
253 data8 compat_sys_getrusage
254 data8 sys32_gettimeofday
255 data8 sys32_settimeofday
256 data8 sys32_getgroups16 /* 80 */
257 data8 sys32_setgroups16
258 data8 sys32_old_select
261 data8 sys_readlink /* 85 */
265 data8 compat_sys_old_readdir
266 data8 sys32_mmap /* 90 */
271 data8 sys_fchown /* 16-bit version */ /* 95 */
272 data8 sys_getpriority
273 data8 sys_setpriority
274 data8 sys_ni_syscall /* old profil syscall holder */
275 data8 compat_sys_statfs
276 data8 compat_sys_fstatfs /* 100 */
277 data8 sys_ni_syscall /* ioperm */
278 data8 compat_sys_socketcall
280 data8 compat_sys_setitimer
281 data8 compat_sys_getitimer /* 105 */
282 data8 compat_sys_newstat
283 data8 compat_sys_newlstat
284 data8 compat_sys_newfstat
286 data8 sys_ni_syscall /* iopl */ /* 110 */
288 data8 sys_ni_syscall /* used to be sys_idle */
290 data8 compat_sys_wait4
291 data8 sys_swapoff /* 115 */
292 data8 compat_sys_sysinfo
295 data8 sys32_sigreturn
296 data8 ia32_clone /* 120 */
297 data8 sys_setdomainname
299 data8 sys32_modify_ldt
300 data8 compat_sys_adjtimex
301 data8 sys32_mprotect /* 125 */
302 data8 compat_sys_sigprocmask
303 data8 sys_ni_syscall /* create_module */
304 data8 sys_ni_syscall /* init_module */
305 data8 sys_ni_syscall /* delete_module */
306 data8 sys_ni_syscall /* get_kernel_syms */ /* 130 */
310 data8 sys_ni_syscall /* sys_bdflush */
311 data8 sys_sysfs /* 135 */
312 data8 sys32_personality
313 data8 sys_ni_syscall /* for afs_syscall */
314 data8 sys_setfsuid /* 16-bit version */
315 data8 sys_setfsgid /* 16-bit version */
316 data8 sys_llseek /* 140 */
317 data8 compat_sys_getdents
318 data8 compat_sys_select
321 data8 compat_sys_readv /* 145 */
322 data8 compat_sys_writev
326 data8 sys_mlock /* 150 */
330 data8 sys_sched_setparam
331 data8 sys_sched_getparam /* 155 */
332 data8 sys_sched_setscheduler
333 data8 sys_sched_getscheduler
334 data8 sys_sched_yield
335 data8 sys_sched_get_priority_max
336 data8 sys_sched_get_priority_min /* 160 */
337 data8 sys32_sched_rr_get_interval
338 data8 compat_sys_nanosleep
340 data8 sys_setresuid /* 16-bit version */
341 data8 sys32_getresuid16 /* 16-bit version */ /* 165 */
342 data8 sys_ni_syscall /* vm86 */
343 data8 sys_ni_syscall /* sys_query_module */
345 data8 sys_ni_syscall /* nfsservctl */
346 data8 sys_setresgid /* 170 */
347 data8 sys32_getresgid16
349 data8 sys32_rt_sigreturn
350 data8 sys32_rt_sigaction
351 data8 sys32_rt_sigprocmask /* 175 */
352 data8 sys_rt_sigpending
353 data8 compat_sys_rt_sigtimedwait
354 data8 sys32_rt_sigqueueinfo
355 data8 compat_sys_rt_sigsuspend
356 data8 sys32_pread /* 180 */
358 data8 sys_chown /* 16-bit version */
361 data8 sys_capset /* 185 */
362 data8 sys32_sigaltstack
364 data8 sys_ni_syscall /* streams1 */
365 data8 sys_ni_syscall /* streams2 */
366 data8 sys32_vfork /* 190 */
367 data8 compat_sys_getrlimit
369 data8 sys32_truncate64
370 data8 sys32_ftruncate64
371 data8 sys32_stat64 /* 195 */
376 data8 sys_getgid /* 200 */
381 data8 sys_getgroups /* 205 */
386 data8 sys_setresgid /* 210 */
391 data8 sys_setfsuid /* 215 */
396 data8 compat_sys_getdents64 /* 220 */
397 data8 compat_sys_fcntl64
398 data8 sys_ni_syscall /* reserved for TUX */
399 data8 sys_ni_syscall /* reserved for Security */
401 data8 sys_readahead /* 225 */
406 data8 sys_lgetxattr /* 230 */
411 data8 sys_removexattr /* 235 */
412 data8 sys_lremovexattr
413 data8 sys_fremovexattr
416 data8 compat_sys_futex /* 240 */
417 data8 compat_sys_sched_setaffinity
418 data8 compat_sys_sched_getaffinity
419 data8 sys32_set_thread_area
420 data8 sys32_get_thread_area
421 data8 compat_sys_io_setup /* 245 */
423 data8 compat_sys_io_getevents
424 data8 compat_sys_io_submit
426 data8 sys_fadvise64 /* 250 */
429 data8 sys_lookup_dcookie
430 data8 sys_epoll_create
431 data8 sys32_epoll_ctl /* 255 */
432 data8 sys32_epoll_wait
433 data8 sys_remap_file_pages
434 data8 sys_set_tid_address
435 data8 compat_sys_timer_create
436 data8 compat_sys_timer_settime /* 260 */
437 data8 compat_sys_timer_gettime
438 data8 sys_timer_getoverrun
439 data8 sys_timer_delete
440 data8 compat_sys_clock_settime
441 data8 compat_sys_clock_gettime /* 265 */
442 data8 compat_sys_clock_getres
443 data8 compat_sys_clock_nanosleep
444 data8 compat_sys_statfs64
445 data8 compat_sys_fstatfs64
446 data8 sys_tgkill /* 270 */
447 data8 compat_sys_utimes
448 data8 sys32_fadvise64_64
451 data8 sys_ni_syscall /* 275 */
453 data8 compat_sys_mq_open
455 data8 compat_sys_mq_timedsend
456 data8 compat_sys_mq_timedreceive /* 280 */
457 data8 compat_sys_mq_notify
458 data8 compat_sys_mq_getsetattr
459 data8 sys_ni_syscall /* reserved for kexec */
460 data8 compat_sys_waitid
462 // guard against failures to increase IA32_NR_syscalls
463 .org ia32_syscall_table + 8*IA32_NR_syscalls