6 * Copyright (C) 1998-2003, 2005 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * Copyright (C) 1999, 2002-2003
9 * Asit Mallick <Asit.K.Mallick@intel.com>
10 * Don Dugger <Don.Dugger@intel.com>
11 * Suresh Siddha <suresh.b.siddha@intel.com>
12 * Fenghua Yu <fenghua.yu@intel.com>
13 * Copyright (C) 1999 VA Linux Systems
14 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
17 * ia64_switch_to now places correct virtual mapping in in TR2 for
18 * kernel stack. This allows us to handle interrupts without changing
21 * Jonathan Nicklin <nicklin@missioncriticallinux.com>
22 * Patrick O'Rourke <orourke@missioncriticallinux.com>
26 * Global (preserved) predicate usage on syscall entry/exit path:
34 #include <linux/config.h>
36 #include <asm/asmmacro.h>
37 #include <asm/cache.h>
38 #include <asm/errno.h>
39 #include <asm/kregs.h>
40 #include <asm/asm-offsets.h>
41 #include <asm/pgtable.h>
42 #include <asm/percpu.h>
43 #include <asm/processor.h>
44 #include <asm/thread_info.h>
45 #include <asm/unistd.h>
50 * execve() is special because in case of success, we need to
51 * setup a null register window frame.
55 * Allocate 8 input registers since ptrace() may clobber them
57 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
58 alloc loc1=ar.pfs,8,2,4,0
61 mov out0=in0 // filename
62 ;; // stop bit between alloc and call
65 add out3=16,sp // regs
66 br.call.sptk.many rp=sys_execve
68 #ifdef CONFIG_IA32_SUPPORT
70 * Check if we're returning to ia32 mode. If so, we need to restore ia32 registers
73 adds r16=PT(CR_IPSR)+16,sp
78 mov ar.pfs=loc1 // restore ar.pfs
79 sxt4 r8=r8 // return 64-bit result
82 (p6) cmp.ne pKStk,pUStk=r0,r0 // a successful execve() lands us in user-mode...
84 (p6) mov ar.pfs=r0 // clear ar.pfs on success
85 (p7) br.ret.sptk.many rp
88 * In theory, we'd have to zap this state only to prevent leaking of
89 * security sensitive state (e.g., if current->mm->dumpable is zero). However,
90 * this executes in less than 20 cycles even on Itanium, so it's not worth
93 mov ar.unat=0; mov ar.lc=0
94 mov r4=0; mov f2=f0; mov b1=r0
95 mov r5=0; mov f3=f0; mov b2=r0
96 mov r6=0; mov f4=f0; mov b3=r0
97 mov r7=0; mov f5=f0; mov b4=r0
98 ldf.fill f12=[sp]; mov f13=f0; mov b5=r0
99 ldf.fill f14=[sp]; ldf.fill f15=[sp]; mov f16=f0
100 ldf.fill f17=[sp]; ldf.fill f18=[sp]; mov f19=f0
101 ldf.fill f20=[sp]; ldf.fill f21=[sp]; mov f22=f0
102 ldf.fill f23=[sp]; ldf.fill f24=[sp]; mov f25=f0
103 ldf.fill f26=[sp]; ldf.fill f27=[sp]; mov f28=f0
104 ldf.fill f29=[sp]; ldf.fill f30=[sp]; mov f31=f0
105 #ifdef CONFIG_IA32_SUPPORT
106 tbit.nz p6,p0=r16, IA64_PSR_IS_BIT
107 movl loc0=ia64_ret_from_ia32_execve
115 * sys_clone2(u64 flags, u64 ustack_base, u64 ustack_size, u64 parent_tidptr, u64 child_tidptr,
118 GLOBAL_ENTRY(sys_clone2)
120 * Allocate 8 input registers since ptrace() may clobber them
122 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
123 alloc r16=ar.pfs,8,2,6,0
125 adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
127 mov loc1=r16 // save ar.pfs across do_fork
131 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
132 mov out4=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
134 (p6) st8 [r2]=in5 // store TLS in r16 for copy_thread()
135 mov out5=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
136 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s
137 mov out0=in0 // out0 = clone_flags
138 br.call.sptk.many rp=do_fork
140 adds sp=IA64_SWITCH_STACK_SIZE,sp // pop the switch stack
147 * sys_clone(u64 flags, u64 ustack_base, u64 parent_tidptr, u64 child_tidptr, u64 tls)
148 * Deprecated. Use sys_clone2() instead.
150 GLOBAL_ENTRY(sys_clone)
152 * Allocate 8 input registers since ptrace() may clobber them
154 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
155 alloc r16=ar.pfs,8,2,6,0
157 adds r2=PT(R16)+IA64_SWITCH_STACK_SIZE+16,sp
159 mov loc1=r16 // save ar.pfs across do_fork
162 mov out3=16 // stacksize (compensates for 16-byte scratch area)
163 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
164 mov out4=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
166 (p6) st8 [r2]=in4 // store TLS in r13 (tp)
167 mov out5=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
168 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s
169 mov out0=in0 // out0 = clone_flags
170 br.call.sptk.many rp=do_fork
172 adds sp=IA64_SWITCH_STACK_SIZE,sp // pop the switch stack
179 * prev_task <- ia64_switch_to(struct task_struct *next)
180 * With Ingo's new scheduler, interrupts are disabled when this routine gets
181 * called. The code starting at .map relies on this. The rest of the code
182 * doesn't care about the interrupt masking status.
184 GLOBAL_ENTRY(ia64_switch_to)
186 alloc r16=ar.pfs,1,0,0,0
190 adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
192 mov r27=IA64_KR(CURRENT_STACK)
193 adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
194 dep r20=0,in0,61,3 // physical address of "next"
196 st8 [r22]=sp // save kernel stack pointer of old task
197 shr.u r26=r20,IA64_GRANULE_SHIFT
201 * If we've already mapped this task's page, we can skip doing it again.
203 (p6) cmp.eq p7,p6=r26,r27
204 (p6) br.cond.dpnt .map
207 ld8 sp=[r21] // load kernel stack pointer of new task
208 mov IA64_KR(CURRENT)=in0 // update "current" application register
209 mov r8=r13 // return pointer to previously running task
210 mov r13=in0 // set "current" pointer
215 sync.i // ensure "fc"s done by this CPU are visible on other CPUs
217 br.ret.sptk.many rp // boogie on out in new context
220 rsm psr.ic // interrupts (psr.i) are already disabled here
224 or r23=r25,r20 // construct PA | page properties
225 mov r25=IA64_GRANULE_SHIFT<<2
228 mov cr.ifa=in0 // VA of next task...
230 mov r25=IA64_TR_CURRENT_STACK
231 mov IA64_KR(CURRENT_STACK)=r26 // remember last page we mapped...
233 itr.d dtr[r25]=r23 // wire in new mapping...
234 ssm psr.ic // reenable the psr.ic bit
241 * Note that interrupts are enabled during save_switch_stack and load_switch_stack. This
242 * means that we may get an interrupt with "sp" pointing to the new kernel stack while
243 * ar.bspstore is still pointing to the old kernel backing store area. Since ar.rsc,
244 * ar.rnat, ar.bsp, and ar.bspstore are all preserved by interrupts, this is not a
245 * problem. Also, we don't need to specify unwind information for preserved registers
246 * that are not modified in save_switch_stack as the right unwind information is already
247 * specified at the call-site of save_switch_stack.
253 * - b7 holds address to return to
254 * - rp (b0) holds return address to save
256 GLOBAL_ENTRY(save_switch_stack)
259 flushrs // flush dirty regs to backing store (must be first in insn group)
261 mov r17=ar.unat // preserve caller's
263 #ifdef CONFIG_ITANIUM
266 adds r14=SW(R4)+16,sp
268 st8.spill [r14]=r4,16 // spill r4
269 lfetch.fault.excl.nt1 [r3],128
271 lfetch.fault.excl.nt1 [r2],128
272 lfetch.fault.excl.nt1 [r3],128
274 lfetch.fault.excl [r2]
275 lfetch.fault.excl [r3]
276 adds r15=SW(R5)+16,sp
282 st8.spill [r14]=r4,SW(R6)-SW(R4) // spill r4 and prefetch offset 0x1c0
283 lfetch.fault.excl.nt1 [r3],128 // prefetch offset 0x010
285 lfetch.fault.excl.nt1 [r3],128 // prefetch offset 0x090
286 lfetch.fault.excl.nt1 [r2],128 // prefetch offset 0x190
288 lfetch.fault.excl.nt1 [r3] // prefetch offset 0x110
289 lfetch.fault.excl.nt1 [r2] // prefetch offset 0x210
290 adds r15=SW(R5)+16,sp
293 st8.spill [r15]=r5,SW(R7)-SW(R5) // spill r5
294 mov.m ar.rsc=0 // put RSE in mode: enforced lazy, little endian, pl 0
295 add r2=SW(F2)+16,sp // r2 = &sw->f2
297 st8.spill [r14]=r6,SW(B0)-SW(R6) // spill r6
298 mov.m r18=ar.fpsr // preserve fpsr
299 add r3=SW(F3)+16,sp // r3 = &sw->f3
306 st8.spill [r15]=r7,SW(B2)-SW(R7) // spill r7
309 // since we're done with the spills, read and save ar.unat:
311 mov.m r20=ar.bspstore
317 st8 [r14]=r21,SW(B1)-SW(B0) // save b0
318 st8 [r15]=r23,SW(B3)-SW(B2) // save b2
322 st8 [r14]=r22,SW(B4)-SW(B1) // save b1
323 st8 [r15]=r24,SW(AR_PFS)-SW(B3) // save b3
324 mov r21=ar.lc // I-unit
325 stf.spill [r2]=f12,32
326 stf.spill [r3]=f13,32
328 st8 [r14]=r25,SW(B5)-SW(B4) // save b4
329 st8 [r15]=r16,SW(AR_LC)-SW(AR_PFS) // save ar.pfs
330 stf.spill [r2]=f14,32
331 stf.spill [r3]=f15,32
333 st8 [r14]=r26 // save b5
334 st8 [r15]=r21 // save ar.lc
335 stf.spill [r2]=f16,32
336 stf.spill [r3]=f17,32
338 stf.spill [r2]=f18,32
339 stf.spill [r3]=f19,32
341 stf.spill [r2]=f20,32
342 stf.spill [r3]=f21,32
344 stf.spill [r2]=f22,32
345 stf.spill [r3]=f23,32
347 stf.spill [r2]=f24,32
348 stf.spill [r3]=f25,32
350 stf.spill [r2]=f26,32
351 stf.spill [r3]=f27,32
353 stf.spill [r2]=f28,32
354 stf.spill [r3]=f29,32
356 stf.spill [r2]=f30,SW(AR_UNAT)-SW(F30)
357 stf.spill [r3]=f31,SW(PR)-SW(F31)
358 add r14=SW(CALLER_UNAT)+16,sp
360 st8 [r2]=r29,SW(AR_RNAT)-SW(AR_UNAT) // save ar.unat
361 st8 [r14]=r17,SW(AR_FPSR)-SW(CALLER_UNAT) // save caller_unat
364 st8 [r2]=r19,SW(AR_BSPSTORE)-SW(AR_RNAT) // save ar.rnat
365 st8 [r3]=r21 // save predicate registers
367 st8 [r2]=r20 // save ar.bspstore
368 st8 [r14]=r18 // save fpsr
369 mov ar.rsc=3 // put RSE back into eager mode, pl 0
371 END(save_switch_stack)
375 * - "invala" MUST be done at call site (normally in DO_LOAD_SWITCH_STACK)
376 * - b7 holds address to return to
377 * - must not touch r8-r11
379 ENTRY(load_switch_stack)
384 lfetch.fault.nt1 [sp]
385 adds r2=SW(AR_BSPSTORE)+16,sp
386 adds r3=SW(AR_UNAT)+16,sp
387 mov ar.rsc=0 // put RSE into enforced lazy mode
388 adds r14=SW(CALLER_UNAT)+16,sp
389 adds r15=SW(AR_FPSR)+16,sp
391 ld8 r27=[r2],(SW(B0)-SW(AR_BSPSTORE)) // bspstore
392 ld8 r29=[r3],(SW(B1)-SW(AR_UNAT)) // unat
394 ld8 r21=[r2],16 // restore b0
395 ld8 r22=[r3],16 // restore b1
397 ld8 r23=[r2],16 // restore b2
398 ld8 r24=[r3],16 // restore b3
400 ld8 r25=[r2],16 // restore b4
401 ld8 r26=[r3],16 // restore b5
403 ld8 r16=[r2],(SW(PR)-SW(AR_PFS)) // ar.pfs
404 ld8 r17=[r3],(SW(AR_RNAT)-SW(AR_LC)) // ar.lc
406 ld8 r28=[r2] // restore pr
407 ld8 r30=[r3] // restore rnat
409 ld8 r18=[r14],16 // restore caller's unat
410 ld8 r19=[r15],24 // restore fpsr
418 ldf.fill f12=[r14],32
419 ldf.fill f13=[r15],32
421 ldf.fill f14=[r14],32
422 ldf.fill f15=[r15],32
424 ldf.fill f16=[r14],32
425 ldf.fill f17=[r15],32
427 ldf.fill f18=[r14],32
428 ldf.fill f19=[r15],32
431 ldf.fill f20=[r14],32
432 ldf.fill f21=[r15],32
435 ldf.fill f22=[r14],32
436 ldf.fill f23=[r15],32
440 mov ar.unat=r29 // establish unat holding the NaT bits for r4-r7
443 ldf.fill f24=[r14],32
444 ldf.fill f25=[r15],32
447 ldf.fill f26=[r14],32
448 ldf.fill f27=[r15],32
451 ldf.fill f28=[r14],32
452 ldf.fill f29=[r15],32
455 ldf.fill f30=[r14],32
456 ldf.fill f31=[r15],24
466 mov ar.unat=r18 // restore caller's unat
467 mov ar.rnat=r30 // must restore after bspstore but before rsc!
468 mov ar.fpsr=r19 // restore fpsr
469 mov ar.rsc=3 // put RSE back into eager mode, pl 0
471 END(load_switch_stack)
473 GLOBAL_ENTRY(prefetch_stack)
474 add r14 = -IA64_SWITCH_STACK_SIZE, sp
475 add r15 = IA64_TASK_THREAD_KSP_OFFSET, in0
477 ld8 r16 = [r15] // load next's stack pointer
478 lfetch.fault.excl [r14], 128
480 lfetch.fault.excl [r14], 128
481 lfetch.fault [r16], 128
483 lfetch.fault.excl [r14], 128
484 lfetch.fault [r16], 128
486 lfetch.fault.excl [r14], 128
487 lfetch.fault [r16], 128
489 lfetch.fault.excl [r14], 128
490 lfetch.fault [r16], 128
492 lfetch.fault [r16], 128
497 mov r15=__NR_execve // put syscall number in place
498 break __BREAK_SYSCALL
503 mov r15=__NR_clone // put syscall number in place
504 break __BREAK_SYSCALL
509 * Invoke a system call, but do some tracing before and after the call.
510 * We MUST preserve the current register frame throughout this routine
511 * because some system calls (such as ia64_execve) directly
514 GLOBAL_ENTRY(ia64_trace_syscall)
515 PT_REGS_UNWIND_INFO(0)
517 * We need to preserve the scratch registers f6-f11 in case the system
520 adds r16=PT(F6)+16,sp
521 adds r17=PT(F7)+16,sp
523 stf.spill [r16]=f6,32
524 stf.spill [r17]=f7,32
526 stf.spill [r16]=f8,32
527 stf.spill [r17]=f9,32
531 br.call.sptk.many rp=syscall_trace_enter // give parent a chance to catch syscall args
532 adds r16=PT(F6)+16,sp
533 adds r17=PT(F7)+16,sp
543 // the syscall number may have changed, so re-load it and re-calculate the
544 // syscall entry-point:
545 adds r15=PT(R15)+16,sp // r15 = &pt_regs.r15 (syscall #)
548 mov r3=NR_syscalls - 1
551 movl r16=sys_call_table
553 shladd r20=r15,3,r16 // r20 = sys_call_table + 8*(syscall-1024)
556 (p6) ld8 r20=[r20] // load address of syscall entry point
557 (p7) movl r20=sys_ni_syscall
560 br.call.sptk.many rp=b6 // do the syscall
561 .strace_check_retval:
562 cmp.lt p6,p0=r8,r0 // syscall failed?
563 adds r2=PT(R8)+16,sp // r2 = &pt_regs.r8
564 adds r3=PT(R10)+16,sp // r3 = &pt_regs.r10
566 (p6) br.cond.sptk strace_error // syscall failed ->
567 ;; // avoid RAW on r10
569 .mem.offset 0,0; st8.spill [r2]=r8 // store return value in slot for r8
570 .mem.offset 8,0; st8.spill [r3]=r10 // clear error indication in slot for r10
571 br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
572 .ret3: br.cond.sptk .work_pending_syscall_end
575 ld8 r3=[r2] // load pt_regs.r8
576 sub r9=0,r8 // negate return value to get errno value
578 cmp.ne p6,p0=r3,r0 // is pt_regs.r8!=0?
579 adds r3=16,r2 // r3=&pt_regs.r10
583 br.cond.sptk .strace_save_retval
584 END(ia64_trace_syscall)
587 * When traced and returning from sigreturn, we invoke syscall_trace but then
588 * go straight to ia64_leave_kernel rather than ia64_leave_syscall.
590 GLOBAL_ENTRY(ia64_strace_leave_kernel)
591 PT_REGS_UNWIND_INFO(0)
593 * Some versions of gas generate bad unwind info if the first instruction of a
594 * procedure doesn't go into the first slot of a bundle. This is a workaround.
598 br.call.sptk.many rp=syscall_trace_leave // give parent a chance to catch return value
600 .ret4: br.cond.sptk ia64_leave_kernel
601 END(ia64_strace_leave_kernel)
603 GLOBAL_ENTRY(ia64_ret_from_clone)
604 PT_REGS_UNWIND_INFO(0)
606 * Some versions of gas generate bad unwind info if the first instruction of a
607 * procedure doesn't go into the first slot of a bundle. This is a workaround.
612 * We need to call schedule_tail() to complete the scheduling process.
613 * Called by ia64_switch_to() after do_fork()->copy_thread(). r8 contains the
614 * address of the previously executing task.
616 br.call.sptk.many rp=ia64_invoke_schedule_tail
619 adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
624 and r2=_TIF_SYSCALL_TRACEAUDIT,r2
627 (p6) br.cond.spnt .strace_check_retval
628 ;; // added stop bits to prevent r8 dependency
629 END(ia64_ret_from_clone)
631 GLOBAL_ENTRY(ia64_ret_from_syscall)
632 PT_REGS_UNWIND_INFO(0)
633 cmp.ge p6,p7=r8,r0 // syscall executed successfully?
634 adds r2=PT(R8)+16,sp // r2 = &pt_regs.r8
635 mov r10=r0 // clear error indication in r10
636 (p7) br.cond.spnt handle_syscall_error // handle potential syscall failure
637 END(ia64_ret_from_syscall)
640 * ia64_leave_syscall(): Same as ia64_leave_kernel, except that it doesn't
641 * need to switch to bank 0 and doesn't restore the scratch registers.
642 * To avoid leaking kernel bits, the scratch registers are set to
643 * the following known-to-be-safe values:
645 * r1: restored (global pointer)
647 * r3: 1 (when returning to user-level)
648 * r8-r11: restored (syscall return value(s))
649 * r12: restored (user-level stack pointer)
650 * r13: restored (user-level thread pointer)
651 * r14: set to __kernel_syscall_via_epc
652 * r15: restored (syscall #)
656 * r20: user-level ar.fpsr
659 * r23: user-level ar.bspstore
660 * r24: user-level ar.rnat
661 * r25: user-level ar.unat
662 * r26: user-level ar.pfs
663 * r27: user-level ar.rsc
665 * r29: user-level psr
666 * r30: user-level cfm
669 * pr: restored (user-level pr)
670 * b0: restored (user-level rp)
672 * b7: set to __kernel_syscall_via_epc
673 * ar.unat: restored (user-level ar.unat)
674 * ar.pfs: restored (user-level ar.pfs)
675 * ar.rsc: restored (user-level ar.rsc)
676 * ar.rnat: restored (user-level ar.rnat)
677 * ar.bspstore: restored (user-level ar.bspstore)
678 * ar.fpsr: restored (user-level ar.fpsr)
683 ENTRY(ia64_leave_syscall)
684 PT_REGS_UNWIND_INFO(0)
686 * work.need_resched etc. mustn't get changed by this CPU before it returns to
687 * user- or fsys-mode, hence we disable interrupts early on.
689 * p6 controls whether current_thread_info()->flags needs to be check for
690 * extra work. We always check for extra work when returning to user-level.
691 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
692 * is 0. After extra work processing has been completed, execution
693 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
694 * needs to be redone.
696 #ifdef CONFIG_PREEMPT
697 rsm psr.i // disable interrupts
698 cmp.eq pLvSys,p0=r0,r0 // pLvSys=1: leave from syscall
699 (pKStk) adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
701 .pred.rel.mutex pUStk,pKStk
702 (pKStk) ld4 r21=[r20] // r21 <- preempt_count
703 (pUStk) mov r21=0 // r21 <- 0
705 cmp.eq p6,p0=r21,r0 // p6 <- pUStk || (preempt_count == 0)
706 #else /* !CONFIG_PREEMPT */
708 cmp.eq pLvSys,p0=r0,r0 // pLvSys=1: leave from syscall
709 (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk
711 .work_processed_syscall:
712 adds r2=PT(LOADRS)+16,r12
713 adds r3=PT(AR_BSPSTORE)+16,r12
714 adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
716 (p6) ld4 r31=[r18] // load current_thread_info()->flags
717 ld8 r19=[r2],PT(B6)-PT(LOADRS) // load ar.rsc value for "loadrs"
720 mov r16=ar.bsp // M2 get existing backing store pointer
721 ld8 r18=[r2],PT(R9)-PT(B6) // load b6
722 (p6) and r15=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE?
724 ld8 r23=[r3],PT(R11)-PT(AR_BSPSTORE) // load ar.bspstore (may be garbage)
725 (p6) cmp4.ne.unc p6,p0=r15, r0 // any special work pending?
726 (p6) br.cond.spnt .work_pending_syscall
728 // start restoring the state saved on the kernel stack (struct pt_regs):
729 ld8 r9=[r2],PT(CR_IPSR)-PT(R9)
730 ld8 r11=[r3],PT(CR_IIP)-PT(R11)
731 (pNonSys) break 0 // bug check: we shouldn't be here if pNonSys is TRUE!
733 invala // M0|1 invalidate ALAT
734 rsm psr.i | psr.ic // M2 turn off interrupts and interruption collection
735 cmp.eq p9,p0=r0,r0 // A set p9 to indicate that we should restore cr.ifs
737 ld8 r29=[r2],16 // M0|1 load cr.ipsr
738 ld8 r28=[r3],16 // M0|1 load cr.iip
739 mov r22=r0 // A clear r22
741 ld8 r30=[r2],16 // M0|1 load cr.ifs
742 ld8 r25=[r3],16 // M0|1 load ar.unat
743 (pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
745 ld8 r26=[r2],PT(B0)-PT(AR_PFS) // M0|1 load ar.pfs
746 (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled
749 ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // M0|1 load b0
750 ld8 r27=[r3],PT(PR)-PT(AR_RSC) // M0|1 load ar.rsc
751 mov f6=f0 // F clear f6
753 ld8 r24=[r2],PT(AR_FPSR)-PT(AR_RNAT) // M0|1 load ar.rnat (may be garbage)
754 ld8 r31=[r3],PT(R1)-PT(PR) // M0|1 load predicates
755 mov f7=f0 // F clear f7
757 ld8 r20=[r2],PT(R12)-PT(AR_FPSR) // M0|1 load ar.fpsr
758 ld8.fill r1=[r3],16 // M0|1 load r1
759 (pUStk) mov r17=1 // A
761 (pUStk) st1 [r14]=r17 // M2|3
762 ld8.fill r13=[r3],16 // M0|1
763 mov f8=f0 // F clear f8
765 ld8.fill r12=[r2] // M0|1 restore r12 (sp)
766 ld8.fill r15=[r3] // M0|1 restore r15
767 mov b6=r18 // I0 restore b6
769 addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0 // A
770 mov f9=f0 // F clear f9
771 (pKStk) br.cond.dpnt.many skip_rbs_switch // B
773 srlz.d // M0 ensure interruption collection is off (for cover)
774 shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition
775 cover // B add current frame into dirty partition & set cr.ifs
777 (pUStk) ld4 r17=[r17] // M0|1 r17 = cpu_data->phys_stacked_size_p8
778 mov r19=ar.bsp // M2 get new backing store pointer
779 mov f10=f0 // F clear f10
782 movl r14=__kernel_syscall_via_epc // X
784 mov.m ar.csd=r0 // M2 clear ar.csd
785 mov.m ar.ccv=r0 // M2 clear ar.ccv
786 mov b7=r14 // I0 clear b7 (hint with __kernel_syscall_via_epc)
788 mov.m ar.ssd=r0 // M2 clear ar.ssd
789 mov f11=f0 // F clear f11
790 br.cond.sptk.many rbs_switch // B
791 END(ia64_leave_syscall)
793 #ifdef CONFIG_IA32_SUPPORT
794 GLOBAL_ENTRY(ia64_ret_from_ia32_execve)
795 PT_REGS_UNWIND_INFO(0)
796 adds r2=PT(R8)+16,sp // r2 = &pt_regs.r8
797 adds r3=PT(R10)+16,sp // r3 = &pt_regs.r10
800 st8.spill [r2]=r8 // store return value in slot for r8 and set unat bit
802 st8.spill [r3]=r0 // clear error indication in slot for r10 and set unat bit
803 END(ia64_ret_from_ia32_execve)
805 #endif /* CONFIG_IA32_SUPPORT */
806 GLOBAL_ENTRY(ia64_leave_kernel)
807 PT_REGS_UNWIND_INFO(0)
809 * work.need_resched etc. mustn't get changed by this CPU before it returns to
810 * user- or fsys-mode, hence we disable interrupts early on.
812 * p6 controls whether current_thread_info()->flags needs to be check for
813 * extra work. We always check for extra work when returning to user-level.
814 * With CONFIG_PREEMPT, we also check for extra work when the preempt_count
815 * is 0. After extra work processing has been completed, execution
816 * resumes at .work_processed_syscall with p6 set to 1 if the extra-work-check
817 * needs to be redone.
819 #ifdef CONFIG_PREEMPT
820 rsm psr.i // disable interrupts
821 cmp.eq p0,pLvSys=r0,r0 // pLvSys=0: leave from kernel
822 (pKStk) adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
824 .pred.rel.mutex pUStk,pKStk
825 (pKStk) ld4 r21=[r20] // r21 <- preempt_count
826 (pUStk) mov r21=0 // r21 <- 0
828 cmp.eq p6,p0=r21,r0 // p6 <- pUStk || (preempt_count == 0)
831 cmp.eq p0,pLvSys=r0,r0 // pLvSys=0: leave from kernel
832 (pUStk) cmp.eq.unc p6,p0=r0,r0 // p6 <- pUStk
834 .work_processed_kernel:
835 adds r17=TI_FLAGS+IA64_TASK_SIZE,r13
837 (p6) ld4 r31=[r17] // load current_thread_info()->flags
838 adds r21=PT(PR)+16,r12
841 lfetch [r21],PT(CR_IPSR)-PT(PR)
842 adds r2=PT(B6)+16,r12
843 adds r3=PT(R16)+16,r12
846 ld8 r28=[r2],8 // load b6
847 adds r29=PT(R24)+16,r12
849 ld8.fill r16=[r3],PT(AR_CSD)-PT(R16)
850 adds r30=PT(AR_CCV)+16,r12
851 (p6) and r19=TIF_WORK_MASK,r31 // any work other than TIF_SYSCALL_TRACE?
854 ld8 r15=[r30] // load ar.ccv
855 (p6) cmp4.ne.unc p6,p0=r19, r0 // any special work pending?
857 ld8 r29=[r2],16 // load b7
858 ld8 r30=[r3],16 // load ar.csd
859 (p6) br.cond.spnt .work_pending
861 ld8 r31=[r2],16 // load ar.ssd
865 ld8.fill r10=[r3],PT(R17)-PT(R10)
867 ld8.fill r11=[r2],PT(R18)-PT(R11)
878 rsm psr.i | psr.ic // initiate turning off of interrupt and interruption collection
879 invala // invalidate ALAT
895 ld8.fill r31=[r2],PT(F9)-PT(R31)
896 adds r3=PT(F10)-PT(F6),r3
898 ldf.fill f9=[r2],PT(F6)-PT(F9)
899 ldf.fill f10=[r3],PT(F8)-PT(F10)
901 ldf.fill f6=[r2],PT(F7)-PT(F6)
903 ldf.fill f7=[r2],PT(F11)-PT(F7)
906 srlz.d // ensure that inter. collection is off (VHPT is don't care, since text is pinned)
910 bsw.0 // switch back to bank 0 (no stop bit required beforehand...)
912 (pUStk) mov r18=IA64_KR(CURRENT)// M2 (12 cycle read latency)
913 adds r16=PT(CR_IPSR)+16,r12
914 adds r17=PT(CR_IIP)+16,r12
916 (pKStk) mov r22=psr // M2 read PSR now that interrupts are disabled
920 ld8 r29=[r16],16 // load cr.ipsr
921 ld8 r28=[r17],16 // load cr.iip
923 ld8 r30=[r16],16 // load cr.ifs
924 ld8 r25=[r17],16 // load ar.unat
926 ld8 r26=[r16],16 // load ar.pfs
927 ld8 r27=[r17],16 // load ar.rsc
928 cmp.eq p9,p0=r0,r0 // set p9 to indicate that we should restore cr.ifs
930 ld8 r24=[r16],16 // load ar.rnat (may be garbage)
931 ld8 r23=[r17],16 // load ar.bspstore (may be garbage)
933 ld8 r31=[r16],16 // load predicates
934 ld8 r21=[r17],16 // load b0
936 ld8 r19=[r16],16 // load ar.rsc value for "loadrs"
937 ld8.fill r1=[r17],16 // load r1
939 ld8.fill r12=[r16],16
940 ld8.fill r13=[r17],16
941 (pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18
943 ld8 r20=[r16],16 // ar.fpsr
944 ld8.fill r15=[r17],16
946 ld8.fill r14=[r16],16
951 (pUStk) st1 [r18]=r17 // restore current->thread.on_ustack
952 shr.u r18=r19,16 // get byte size of existing "dirty" partition
954 mov r16=ar.bsp // get existing backing store pointer
955 addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
957 ld4 r17=[r17] // r17 = cpu_data->phys_stacked_size_p8
958 (pKStk) br.cond.dpnt skip_rbs_switch
961 * Restore user backing store.
963 * NOTE: alloc, loadrs, and cover can't be predicated.
965 (pNonSys) br.cond.dpnt dont_preserve_current_frame
966 cover // add current frame into dirty partition and set cr.ifs
968 mov r19=ar.bsp // get new backing store pointer
970 sub r16=r16,r18 // krbs = old bsp - size of dirty partition
971 cmp.ne p9,p0=r0,r0 // clear p9 to skip restore of cr.ifs
973 sub r19=r19,r16 // calculate total byte size of dirty partition
974 add r18=64,r18 // don't force in0-in7 into memory...
976 shl r19=r19,16 // shift size of dirty partition into loadrs position
978 dont_preserve_current_frame:
980 * To prevent leaking bits between the kernel and user-space,
981 * we must clear the stacked registers in the "invalid" partition here.
982 * Not pretty, but at least it's fast (3.34 registers/cycle on Itanium,
983 * 5 registers/cycle on McKinley).
987 #ifdef CONFIG_ITANIUM
992 alloc loc0=ar.pfs,2,Nregs-2,2,0
993 shr.u loc1=r18,9 // RNaTslots <= floor(dirtySize / (64*8))
994 sub r17=r17,r18 // r17 = (physStackedSize + 8) - dirtySize
996 mov ar.rsc=r19 // load ar.rsc to be used for "loadrs"
997 shladd in0=loc1,3,r17
1002 #ifdef CONFIG_ITANIUM
1005 alloc loc0=ar.pfs,2,Nregs-2,2,0
1006 cmp.lt pRecurse,p0=Nregs*8,in0 // if more than Nregs regs left to clear, (re)curse
1007 add out0=-Nregs*8,in0
1009 add out1=1,in1 // increment recursion count
1011 nop.b 0 // can't do br.call here because of alloc (WAW on CFM)
1020 (pRecurse) br.call.sptk.many b0=rse_clear_invalid
1025 cmp.ne pReturn,p0=r0,in1 // if recursion count != 0, we need to do a br.ret
1029 (pReturn) br.ret.sptk.many b0
1031 #else /* !CONFIG_ITANIUM */
1032 alloc loc0=ar.pfs,2,Nregs-2,2,0
1033 cmp.lt pRecurse,p0=Nregs*8,in0 // if more than Nregs regs left to clear, (re)curse
1034 add out0=-Nregs*8,in0
1035 add out1=1,in1 // increment recursion count
1044 (pRecurse) br.call.dptk.few b0=rse_clear_invalid
1048 cmp.ne pReturn,p0=r0,in1 // if recursion count != 0, we need to do a br.ret
1051 (pReturn) br.ret.dptk.many b0
1052 #endif /* !CONFIG_ITANIUM */
1056 alloc r17=ar.pfs,0,0,0,0 // drop current register frame
1061 mov ar.unat=r25 // M2
1062 (pKStk) extr.u r22=r22,21,1 // I0 extract current value of psr.pp from r22
1063 (pLvSys)mov r19=r0 // A clear r19 for leave_syscall, no-op otherwise
1065 (pUStk) mov ar.bspstore=r23 // M2
1066 (pKStk) dep r29=r22,r29,21,1 // I0 update ipsr.pp with psr.pp
1067 (pLvSys)mov r16=r0 // A clear r16 for leave_syscall, no-op otherwise
1069 mov cr.ipsr=r29 // M2
1070 mov ar.pfs=r26 // I0
1071 (pLvSys)mov r17=r0 // A clear r17 for leave_syscall, no-op otherwise
1073 (p9) mov cr.ifs=r30 // M2
1075 (pLvSys)mov r18=r0 // A clear r18 for leave_syscall, no-op otherwise
1077 mov ar.fpsr=r20 // M2
1078 mov cr.iip=r28 // M2
1081 (pUStk) mov ar.rnat=r24 // M2 must happen with RSE in lazy mode
1085 mov ar.rsc=r27 // M2
1091 * r20 = ¤t->thread_info->pre_count (if CONFIG_PREEMPT)
1092 * r31 = current->thread_info->flags
1094 * p6 = TRUE if work-pending-check needs to be redone
1096 .work_pending_syscall:
1103 tbit.nz p6,p0=r31,TIF_SIGDELAYED // signal delayed from MCA/INIT/NMI/PMI context?
1104 (p6) br.cond.sptk.few .sigdelayed
1106 tbit.z p6,p0=r31,TIF_NEED_RESCHED // current_thread_info()->need_resched==0?
1107 (p6) br.cond.sptk.few .notify
1108 #ifdef CONFIG_PREEMPT
1109 (pKStk) dep r21=-1,r0,PREEMPT_ACTIVE_BIT,1
1111 (pKStk) st4 [r20]=r21
1112 ssm psr.i // enable interrupts
1114 br.call.spnt.many rp=schedule
1115 .ret9: cmp.eq p6,p0=r0,r0 // p6 <- 1
1116 rsm psr.i // disable interrupts
1118 #ifdef CONFIG_PREEMPT
1119 (pKStk) adds r20=TI_PRE_COUNT+IA64_TASK_SIZE,r13
1121 (pKStk) st4 [r20]=r0 // preempt_count() <- 0
1123 (pLvSys)br.cond.sptk.few .work_pending_syscall_end
1124 br.cond.sptk.many .work_processed_kernel // re-check
1127 (pUStk) br.call.spnt.many rp=notify_resume_user
1128 .ret10: cmp.ne p6,p0=r0,r0 // p6 <- 0
1129 (pLvSys)br.cond.sptk.few .work_pending_syscall_end
1130 br.cond.sptk.many .work_processed_kernel // don't re-check
1132 // There is a delayed signal that was detected in MCA/INIT/NMI/PMI context where
1133 // it could not be delivered. Deliver it now. The signal might be for us and
1134 // may set TIF_SIGPENDING, so redrive ia64_leave_* after processing the delayed
1138 br.call.sptk.many rp=do_sigdelayed
1139 cmp.eq p6,p0=r0,r0 // p6 <- 1, always re-check
1140 (pLvSys)br.cond.sptk.few .work_pending_syscall_end
1141 br.cond.sptk.many .work_processed_kernel // re-check
1143 .work_pending_syscall_end:
1144 adds r2=PT(R8)+16,r12
1145 adds r3=PT(R10)+16,r12
1149 br.cond.sptk.many .work_processed_syscall // re-check
1151 END(ia64_leave_kernel)
1153 ENTRY(handle_syscall_error)
1155 * Some system calls (e.g., ptrace, mmap) can return arbitrary values which could
1156 * lead us to mistake a negative return value as a failed syscall. Those syscall
1157 * must deposit a non-zero value in pt_regs.r8 to indicate an error. If
1158 * pt_regs.r8 is zero, we assume that the call completed successfully.
1160 PT_REGS_UNWIND_INFO(0)
1161 ld8 r3=[r2] // load pt_regs.r8
1163 cmp.eq p6,p7=r3,r0 // is pt_regs.r8==0?
1166 (p7) sub r8=0,r8 // negate return value to get errno
1167 br.cond.sptk ia64_leave_syscall
1168 END(handle_syscall_error)
1171 * Invoke schedule_tail(task) while preserving in0-in7, which may be needed
1172 * in case a system call gets restarted.
1174 GLOBAL_ENTRY(ia64_invoke_schedule_tail)
1175 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
1176 alloc loc1=ar.pfs,8,2,1,0
1178 mov out0=r8 // Address of previous task
1180 br.call.sptk.many rp=schedule_tail
1181 .ret11: mov ar.pfs=loc1
1184 END(ia64_invoke_schedule_tail)
1187 * Setup stack and call do_notify_resume_user(). Note that pSys and pNonSys need to
1188 * be set up by the caller. We declare 8 input registers so the system call
1189 * args get preserved, in case we need to restart a system call.
1191 ENTRY(notify_resume_user)
1192 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
1193 alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
1195 mov loc0=rp // save return address
1196 mov out0=0 // there is no "oldset"
1197 adds out1=8,sp // out1=&sigscratch->ar_pfs
1198 (pSys) mov out2=1 // out2==1 => we're in a syscall
1200 (pNonSys) mov out2=0 // out2==0 => not a syscall
1202 .spillsp ar.unat, 16
1203 st8 [sp]=r9,-16 // allocate space for ar.unat and save it
1204 st8 [out1]=loc1,-8 // save ar.pfs, out1=&sigscratch
1206 br.call.sptk.many rp=do_notify_resume_user
1208 adds sp=16,sp // pop scratch stack space
1210 ld8 r9=[sp] // load new unat from sigscratch->scratch_unat
1216 END(notify_resume_user)
1218 GLOBAL_ENTRY(sys_rt_sigsuspend)
1219 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
1220 alloc loc1=ar.pfs,8,2,3,0 // preserve all eight input regs in case of syscall restart!
1222 mov loc0=rp // save return address
1223 mov out0=in0 // mask
1224 mov out1=in1 // sigsetsize
1225 adds out2=8,sp // out2=&sigscratch->ar_pfs
1228 .spillsp ar.unat, 16
1229 st8 [sp]=r9,-16 // allocate space for ar.unat and save it
1230 st8 [out2]=loc1,-8 // save ar.pfs, out2=&sigscratch
1232 br.call.sptk.many rp=ia64_rt_sigsuspend
1234 adds sp=16,sp // pop scratch stack space
1236 ld8 r9=[sp] // load new unat from sw->caller_unat
1242 END(sys_rt_sigsuspend)
1244 ENTRY(sys_rt_sigreturn)
1245 PT_REGS_UNWIND_INFO(0)
1247 * Allocate 8 input registers since ptrace() may clobber them
1249 alloc r2=ar.pfs,8,0,1,0
1254 cmp.eq pNonSys,pSys=r0,r0 // sigreturn isn't a normal syscall...
1257 * leave_kernel() restores f6-f11 from pt_regs, but since the streamlined
1258 * syscall-entry path does not save them we save them here instead. Note: we
1259 * don't need to save any other registers that are not saved by the stream-lined
1260 * syscall path, because restore_sigcontext() restores them.
1262 adds r16=PT(F6)+32,sp
1263 adds r17=PT(F7)+32,sp
1265 stf.spill [r16]=f6,32
1266 stf.spill [r17]=f7,32
1268 stf.spill [r16]=f8,32
1269 stf.spill [r17]=f9,32
1273 adds out0=16,sp // out0 = &sigscratch
1274 br.call.sptk.many rp=ia64_rt_sigreturn
1275 .ret19: .restore sp,0
1278 ld8 r9=[sp] // load new ar.unat
1279 mov.sptk b7=r8,ia64_leave_kernel
1283 END(sys_rt_sigreturn)
1285 GLOBAL_ENTRY(ia64_prepare_handle_unaligned)
1288 * r16 = fake ar.pfs, we simply need to make sure privilege is still 0
1291 DO_SAVE_SWITCH_STACK
1292 br.call.sptk.many rp=ia64_handle_unaligned // stack frame setup in ivt
1294 DO_LOAD_SWITCH_STACK
1295 br.cond.sptk.many rp // goes to ia64_leave_kernel
1296 END(ia64_prepare_handle_unaligned)
1299 // unw_init_running(void (*callback)(info, arg), void *arg)
1301 # define EXTRA_FRAME_SIZE ((UNW_FRAME_INFO_SIZE+15)&~15)
1303 GLOBAL_ENTRY(unw_init_running)
1304 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
1305 alloc loc1=ar.pfs,2,3,3,0
1310 DO_SAVE_SWITCH_STACK
1313 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(2)
1314 .fframe IA64_SWITCH_STACK_SIZE+EXTRA_FRAME_SIZE
1315 SWITCH_STACK_SAVES(EXTRA_FRAME_SIZE)
1316 adds sp=-EXTRA_FRAME_SIZE,sp
1319 adds out0=16,sp // &info
1320 mov out1=r13 // current
1321 adds out2=16+EXTRA_FRAME_SIZE,sp // &switch_stack
1322 br.call.sptk.many rp=unw_init_frame_info
1323 1: adds out0=16,sp // &info
1325 mov loc2=gp // save gp across indirect function call
1329 br.call.sptk.many rp=b6 // invoke the callback function
1330 1: mov gp=loc2 // restore gp
1332 // For now, we don't allow changing registers from within
1333 // unw_init_running; if we ever want to allow that, we'd
1334 // have to do a load_switch_stack here:
1336 adds sp=IA64_SWITCH_STACK_SIZE+EXTRA_FRAME_SIZE,sp
1341 END(unw_init_running)
1345 .globl sys_call_table
1347 data8 sys_ni_syscall // This must be sys_ni_syscall! See ivt.S.
1348 data8 sys_exit // 1025
1353 data8 sys_creat // 1030
1358 data8 sys_fchdir // 1035
1363 data8 sys_lseek // 1040
1368 data8 sys_setuid // 1045
1373 data8 sys_sync // 1050
1378 data8 sys_mkdir // 1055
1383 data8 ia64_brk // 1060
1388 data8 sys_ioctl // 1065
1393 data8 sys_dup2 // 1070
1398 data8 sys_getresgid // 1075
1403 data8 sys_setpgid // 1080
1406 data8 sys_sethostname
1408 data8 sys_getrlimit // 1085
1410 data8 sys_gettimeofday
1411 data8 sys_settimeofday
1413 data8 sys_poll // 1090
1418 data8 sys_swapoff // 1095
1423 data8 sys_fchown // 1100
1424 data8 ia64_getpriority
1425 data8 sys_setpriority
1428 data8 sys_gettid // 1105
1433 data8 sys_msgsnd // 1110
1438 data8 sys_shmdt // 1115
1443 data8 sys_ni_syscall // 1120 /* was: ia64_oldstat */
1444 data8 sys_ni_syscall /* was: ia64_oldlstat */
1445 data8 sys_ni_syscall /* was: ia64_oldfstat */
1448 data8 sys_remap_file_pages // 1125
1452 data8 sys_setdomainname
1453 data8 sys_newuname // 1130
1455 data8 sys_ni_syscall /* was: ia64_create_module */
1456 data8 sys_init_module
1457 data8 sys_delete_module
1458 data8 sys_ni_syscall // 1135 /* was: sys_get_kernel_syms */
1459 data8 sys_ni_syscall /* was: sys_query_module */
1463 data8 sys_personality // 1140
1464 data8 sys_ni_syscall // sys_afs_syscall
1468 data8 sys_flock // 1145
1473 data8 sys_sysctl // 1150
1478 data8 sys_mprotect // 1155
1482 data8 sys_munlockall
1483 data8 sys_sched_getparam // 1160
1484 data8 sys_sched_setparam
1485 data8 sys_sched_getscheduler
1486 data8 sys_sched_setscheduler
1487 data8 sys_sched_yield
1488 data8 sys_sched_get_priority_max // 1165
1489 data8 sys_sched_get_priority_min
1490 data8 sys_sched_rr_get_interval
1492 data8 sys_nfsservctl
1493 data8 sys_prctl // 1170
1494 data8 sys_getpagesize
1496 data8 sys_pciconfig_read
1497 data8 sys_pciconfig_write
1498 data8 sys_perfmonctl // 1175
1499 data8 sys_sigaltstack
1500 data8 sys_rt_sigaction
1501 data8 sys_rt_sigpending
1502 data8 sys_rt_sigprocmask
1503 data8 sys_rt_sigqueueinfo // 1180
1504 data8 sys_rt_sigreturn
1505 data8 sys_rt_sigsuspend
1506 data8 sys_rt_sigtimedwait
1508 data8 sys_capget // 1185
1510 data8 sys_sendfile64
1511 data8 sys_ni_syscall // sys_getpmsg (STREAMS)
1512 data8 sys_ni_syscall // sys_putpmsg (STREAMS)
1513 data8 sys_socket // 1190
1518 data8 sys_getsockname // 1195
1519 data8 sys_getpeername
1520 data8 sys_socketpair
1523 data8 sys_recv // 1200
1526 data8 sys_setsockopt
1527 data8 sys_getsockopt
1528 data8 sys_sendmsg // 1205
1530 data8 sys_pivot_root
1533 data8 sys_newstat // 1210
1537 data8 sys_getdents64
1538 data8 sys_getunwind // 1215
1543 data8 sys_getxattr // 1220
1547 data8 sys_llistxattr
1548 data8 sys_flistxattr // 1225
1549 data8 sys_removexattr
1550 data8 sys_lremovexattr
1551 data8 sys_fremovexattr
1553 data8 sys_futex // 1230
1554 data8 sys_sched_setaffinity
1555 data8 sys_sched_getaffinity
1556 data8 sys_set_tid_address
1557 data8 sys_fadvise64_64
1558 data8 sys_tgkill // 1235
1559 data8 sys_exit_group
1560 data8 sys_lookup_dcookie
1562 data8 sys_io_destroy
1563 data8 sys_io_getevents // 1240
1566 data8 sys_epoll_create
1568 data8 sys_epoll_wait // 1245
1569 data8 sys_restart_syscall
1570 data8 sys_semtimedop
1571 data8 sys_timer_create
1572 data8 sys_timer_settime
1573 data8 sys_timer_gettime // 1250
1574 data8 sys_timer_getoverrun
1575 data8 sys_timer_delete
1576 data8 sys_clock_settime
1577 data8 sys_clock_gettime
1578 data8 sys_clock_getres // 1255
1579 data8 sys_clock_nanosleep
1583 data8 sys_get_mempolicy // 1260
1584 data8 sys_set_mempolicy
1587 data8 sys_mq_timedsend
1588 data8 sys_mq_timedreceive // 1265
1590 data8 sys_mq_getsetattr
1591 data8 sys_ni_syscall // reserved for kexec_load
1592 data8 sys_ni_syscall // reserved for vserver
1593 data8 sys_waitid // 1270
1595 data8 sys_request_key
1597 data8 sys_ioprio_set
1598 data8 sys_ioprio_get // 1275
1599 data8 sys_ni_syscall
1600 data8 sys_inotify_init
1601 data8 sys_inotify_add_watch
1602 data8 sys_inotify_rm_watch
1604 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls