2 * This file contains the light-weight system call handlers (fsyscall-handlers).
4 * Copyright (C) 2003 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
7 * 25-Sep-03 davidm Implement fsys_rt_sigprocmask().
8 * 18-Feb-03 louisk Implement fsys_gettimeofday().
9 * 28-Feb-03 davidm Fixed several bugs in fsys_gettimeofday(). Tuned it some more,
10 * probably broke it along the way... ;-)
11 * 13-Jul-04 clameter Implement fsys_clock_gettime and revise fsys_gettimeofday to make
12 * it capable of using memory based clocks without falling back to C code.
13 * 08-Feb-07 Fenghua Yu Implement fsys_getcpu.
17 #include <asm/asmmacro.h>
18 #include <asm/errno.h>
19 #include <asm/asm-offsets.h>
20 #include <asm/percpu.h>
21 #include <asm/thread_info.h>
23 #include <asm/signal.h>
24 #include <asm/unistd.h>
27 #include "paravirt_inst.h"
30 * See Documentation/ia64/fsys.txt for details on fsyscalls.
32 * On entry to an fsyscall handler:
33 * r10 = 0 (i.e., defaults to "successful syscall return")
34 * r11 = saved ar.pfs (a user-level value)
35 * r15 = system call number
36 * r16 = "current" task pointer (in normal kernel-mode, this is in r13)
37 * r32-r39 = system call arguments
38 * b6 = return address (a user-level value)
39 * ar.pfs = previous frame-state (a user-level value)
40 * PSR.be = cleared to zero (i.e., little-endian byte order is in effect)
41 * all other registers may contain values passed in from user-mode
43 * On return from an fsyscall handler:
44 * r11 = saved ar.pfs (as passed into the fsyscall handler)
45 * r15 = system call number (as passed into the fsyscall handler)
46 * r32-r39 = system call arguments (as passed into the fsyscall handler)
47 * b6 = return address (as passed into the fsyscall handler)
48 * ar.pfs = previous frame-state (as passed into the fsyscall handler)
51 ENTRY(fsys_ni_syscall)
64 add r17=IA64_TASK_GROUP_LEADER_OFFSET,r16
66 ld8 r17=[r17] // r17 = current->group_leader
67 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
70 add r17=IA64_TASK_TGIDLINK_OFFSET,r17
72 and r9=TIF_ALLWORK_MASK,r9
73 ld8 r17=[r17] // r17 = current->group_leader->pids[PIDTYPE_PID].pid
75 add r8=IA64_PID_LEVEL_OFFSET,r17
77 ld4 r8=[r8] // r8 = pid->level
78 add r17=IA64_PID_UPID_OFFSET,r17 // r17 = &pid->numbers[0]
80 shl r8=r8,IA64_UPID_SHIFT
82 add r17=r17,r8 // r17 = &pid->numbers[pid->level]
84 ld4 r8=[r17] // r8 = pid->numbers[pid->level].nr
89 (p8) br.spnt.many fsys_fallback_syscall
97 add r17=IA64_TASK_GROUP_LEADER_OFFSET,r16
99 ld8 r17=[r17] // r17 = current->group_leader
100 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
104 add r17=IA64_TASK_REAL_PARENT_OFFSET,r17 // r17 = ¤t->group_leader->real_parent
106 and r9=TIF_ALLWORK_MASK,r9
108 1: ld8 r18=[r17] // r18 = current->group_leader->real_parent
111 add r8=IA64_TASK_TGID_OFFSET,r18 // r8 = ¤t->group_leader->real_parent->tgid
115 * The .acq is needed to ensure that the read of tgid has returned its data before
116 * we re-check "real_parent".
118 ld4.acq r8=[r8] // r8 = current->group_leader->real_parent->tgid
121 * Re-read current->group_leader->real_parent.
123 ld8 r19=[r17] // r19 = current->group_leader->real_parent
124 (p8) br.spnt.many fsys_fallback_syscall
126 cmp.ne p6,p0=r18,r19 // did real_parent change?
127 mov r19=0 // i must not leak kernel bits...
128 (p6) br.cond.spnt.few 1b // yes -> redo the read of tgid and the check
130 mov r17=0 // i must not leak kernel bits...
131 mov r18=0 // i must not leak kernel bits...
133 mov r17=0 // i must not leak kernel bits...
134 mov r18=0 // i must not leak kernel bits...
135 mov r19=0 // i must not leak kernel bits...
140 ENTRY(fsys_set_tid_address)
144 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
145 add r17=IA64_TASK_TGIDLINK_OFFSET,r16
148 tnat.z p6,p7=r32 // check argument register for being NaT
149 ld8 r17=[r17] // r17 = current->pids[PIDTYPE_PID].pid
151 and r9=TIF_ALLWORK_MASK,r9
152 add r8=IA64_PID_LEVEL_OFFSET,r17
153 add r18=IA64_TASK_CLEAR_CHILD_TID_OFFSET,r16
155 ld4 r8=[r8] // r8 = pid->level
156 add r17=IA64_PID_UPID_OFFSET,r17 // r17 = &pid->numbers[0]
158 shl r8=r8,IA64_UPID_SHIFT
160 add r17=r17,r8 // r17 = &pid->numbers[pid->level]
162 ld4 r8=[r17] // r8 = pid->numbers[pid->level].nr
169 (p8) br.spnt.many fsys_fallback_syscall
171 mov r17=0 // i must not leak kernel bits...
172 mov r18=0 // i must not leak kernel bits...
174 END(fsys_set_tid_address)
176 #if IA64_GTOD_SEQ_OFFSET !=0
177 #error fsys_gettimeofday incompatible with changes to struct fsyscall_gtod_data_t
179 #if IA64_ITC_JITTER_OFFSET !=0
180 #error fsys_gettimeofday incompatible with changes to struct itc_jitter_data_t
182 #define CLOCK_REALTIME 0
183 #define CLOCK_MONOTONIC 1
184 #define CLOCK_DIVIDE_BY_1000 0x4000
185 #define CLOCK_ADD_MONOTONIC 0x8000
187 ENTRY(fsys_gettimeofday)
192 tnat.nz p6,p0 = r33 // guard against NaT argument
193 (p6) br.cond.spnt.few .fail_einval
194 mov r30 = CLOCK_DIVIDE_BY_1000
198 // Incoming r31 = pointer to address where to place result
199 // r30 = flags determining how time is processed
200 // r2,r3 = temp r4-r7 preserved
201 // r8 = result nanoseconds
202 // r9 = result seconds
203 // r10 = temporary storage for clock difference
204 // r11 = preserved: saved ar.pfs
205 // r12 = preserved: memory stack
206 // r13 = preserved: thread pointer
207 // r14 = address of mask / mask value
208 // r15 = preserved: system call number
209 // r16 = preserved: current task pointer
212 // r19 = address of itc_lastcycle
213 // r20 = struct fsyscall_gtod_data (= address of gtod_lock.sequence)
214 // r21 = address of mmio_ptr
215 // r22 = address of wall_time or monotonic_time
216 // r23 = address of shift / value
217 // r24 = address mult factor / cycle_last value
218 // r25 = itc_lastcycle value
219 // r26 = address clocksource cycle_last
221 // r28 = sequence number at the beginning of critcal section
222 // r29 = address of itc_jitter
223 // r30 = time processing flags / memory address
224 // r31 = pointer to result
226 // p6,p7 short term use
227 // p8 = timesource ar.itc
228 // p9 = timesource mmio64
229 // p10 = timesource mmio32 - not used
230 // p11 = timesource not to be handled by asm code
231 // p12 = memory time source ( = p9 | p10) - not used
232 // p13 = do cmpxchg with itc_lastcycle
233 // p14 = Divide by 1000
234 // p15 = Add monotonic
236 // Note that instructions are optimized for McKinley. McKinley can
237 // process two bundles simultaneously and therefore we continuously
238 // try to feed the CPU two bundles and then a stop.
240 add r2 = TI_FLAGS+IA64_TASK_SIZE,r16
241 tnat.nz p6,p0 = r31 // guard against Nat argument
242 (p6) br.cond.spnt.few .fail_einval
243 movl r20 = fsyscall_gtod_data // load fsyscall gettimeofday data address
245 ld4 r2 = [r2] // process work pending flags
246 movl r29 = itc_jitter_data // itc_jitter
247 add r22 = IA64_GTOD_WALL_TIME_OFFSET,r20 // wall_time
248 add r21 = IA64_CLKSRC_MMIO_OFFSET,r20
249 mov pr = r30,0xc000 // Set predicates according to function
251 and r2 = TIF_ALLWORK_MASK,r2
252 add r19 = IA64_ITC_LASTCYCLE_OFFSET,r29
253 (p15) add r22 = IA64_GTOD_MONO_TIME_OFFSET,r20 // monotonic_time
255 add r26 = IA64_CLKSRC_CYCLE_LAST_OFFSET,r20 // clksrc_cycle_last
256 cmp.ne p6, p0 = 0, r2 // Fallback if work is scheduled
257 (p6) br.cond.spnt.many fsys_fallback_syscall
259 // Begin critical section
261 ld4.acq r28 = [r20] // gtod_lock.sequence, Must take first
263 and r28 = ~1,r28 // And make sequence even to force retry if odd
265 ld8 r30 = [r21] // clocksource->mmio_ptr
266 add r24 = IA64_CLKSRC_MULT_OFFSET,r20
267 ld4 r2 = [r29] // itc_jitter value
268 add r23 = IA64_CLKSRC_SHIFT_OFFSET,r20
269 add r14 = IA64_CLKSRC_MASK_OFFSET,r20
271 ld4 r3 = [r24] // clocksource mult value
272 ld8 r14 = [r14] // clocksource mask value
273 cmp.eq p8,p9 = 0,r30 // use cpu timer if no mmio_ptr
275 setf.sig f7 = r3 // Setup for mult scaling of counter
276 (p8) cmp.ne p13,p0 = r2,r0 // need itc_jitter compensation, set p13
277 ld4 r23 = [r23] // clocksource shift value
278 ld8 r24 = [r26] // get clksrc_cycle_last value
279 (p9) cmp.eq p13,p0 = 0,r30 // if mmio_ptr, clear p13 jitter control
281 .pred.rel.mutex p8,p9
282 MOV_FROM_ITC(p8, p6, r2, r10) // CPU_TIMER. 36 clocks latency!!!
283 (p9) ld8 r2 = [r30] // MMIO_TIMER. Could also have latency issues..
284 (p13) ld8 r25 = [r19] // get itc_lastcycle value
285 ld8 r9 = [r22],IA64_TIMESPEC_TV_NSEC_OFFSET // tv_sec
287 ld8 r8 = [r22],-IA64_TIMESPEC_TV_NSEC_OFFSET // tv_nsec
288 (p13) sub r3 = r25,r2 // Diff needed before comparison (thanks davidm)
290 (p13) cmp.gt.unc p6,p7 = r3,r0 // check if it is less than last. p6,p7 cleared
291 sub r10 = r2,r24 // current_cycle - last_cycle
293 (p6) sub r10 = r25,r24 // time we got was less than last_cycle
294 (p7) mov ar.ccv = r25 // more than last_cycle. Prep for cmpxchg
296 (p7) cmpxchg8.rel r3 = [r19],r2,ar.ccv
298 (p7) cmp.ne p7,p0 = r25,r3 // if cmpxchg not successful
300 (p7) sub r10 = r3,r24 // then use new last_cycle instead
302 and r10 = r10,r14 // Apply mask
307 // fault check takes 5 cycles and we have spare time
308 EX(.fail_efault, probe.w.fault r31, 3)
309 xmpy.l f8 = f8,f7 // nsec_per_cyc*(counter-last_counter)
314 ld4 r10 = [r20] // gtod_lock.sequence
315 shr.u r2 = r2,r23 // shift by factor
317 add r8 = r8,r2 // Add xtime.nsecs
318 cmp4.ne p7,p0 = r28,r10
319 (p7) br.cond.dpnt.few .time_redo // sequence number changed, redo
320 // End critical section.
321 // Now r8=tv->tv_nsec and r9=tv->tv_sec
324 add r23 = IA64_TIMESPEC_TV_NSEC_OFFSET, r31
325 (p14) movl r3 = 2361183241434822607 // Prep for / 1000 hack
330 (p14) shr.u r20 = r8, 3 // We can repeat this if necessary just wasting time
332 (p14) setf.sig f8 = r20
334 (p6) add r9 = 1,r9 // two nops before the branch.
335 (p14) setf.sig f7 = r3 // Chances for repeats are 1 in 10000 for gettod
336 (p6) br.cond.dpnt.few .time_normalize
338 // Divided by 8 though shift. Now divide by 125
339 // The compiler was able to do that with a multiply
340 // and a shift and we do the same
341 EX(.fail_efault, probe.w.fault r23, 3) // This also costs 5 cycles
342 (p14) xmpy.hu f8 = f8, f7 // xmpy has 5 cycles latency so use it
344 (p14) getf.sig r2 = f8
347 (p14) shr.u r21 = r2, 4
349 EX(.fail_efault, st8 [r31] = r9)
350 EX(.fail_efault, st8 [r23] = r21)
360 END(fsys_gettimeofday)
362 ENTRY(fsys_clock_gettime)
366 cmp4.ltu p6, p0 = CLOCK_MONOTONIC, r32
367 // Fallback if this is not CLOCK_REALTIME or CLOCK_MONOTONIC
368 (p6) br.spnt.few fsys_fallback_syscall
372 END(fsys_clock_gettime)
375 * long fsys_rt_sigprocmask (int how, sigset_t *set, sigset_t *oset, size_t sigsetsize).
378 # error Sorry, fsys_rt_sigprocmask() needs to be updated for _NSIG_WORDS != 1.
380 ENTRY(fsys_rt_sigprocmask)
385 add r2=IA64_TASK_BLOCKED_OFFSET,r16
386 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
387 cmp4.ltu p6,p0=SIG_SETMASK,r32
389 cmp.ne p15,p0=r0,r34 // oset != NULL?
391 add r31=IA64_TASK_SIGHAND_OFFSET,r16
393 ld8 r3=[r2] // read/prefetch current->blocked
397 cmp.ne.or p6,p0=_NSIG_WORDS*8,r35
399 (p6) br.spnt.few .fail_einval // fail with EINVAL
402 ld8 r31=[r31] // r31 <- current->sighand
404 and r9=TIF_ALLWORK_MASK,r9
408 cmp.eq p6,p0=r0,r33 // set == NULL?
409 add r31=IA64_SIGHAND_SIGLOCK_OFFSET,r31 // r31 <- current->sighand->siglock
410 (p8) br.spnt.few .fail_efault // fail with EFAULT
411 (p7) br.spnt.many fsys_fallback_syscall // got pending kernel work...
412 (p6) br.dpnt.many .store_mask // -> short-circuit to just reading the signal mask
414 /* Argh, we actually have to do some work and _update_ the signal mask: */
416 EX(.fail_efault, probe.r.fault r33, 3) // verify user has read-access to *set
417 EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set
418 mov r17=(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1))
421 RSM_PSR_I(p0, r18, r19) // mask interrupt delivery
422 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP
423 mov r8=EINVAL // default to EINVAL
426 // __ticket_spin_trylock(r31)
436 (p6) cmpxchg4.acq r9=[r31],r19,ar.ccv
437 (p6) dep.z r20=r19,1,15 // next serving ticket for unlock
438 (p7) br.cond.spnt.many .lock_contention
442 (p7) br.cond.spnt.many .lock_contention
443 ld8 r3=[r2] // re-read current->blocked now that we hold the lock
446 ld8 r3=[r2] // re-read current->blocked now that we hold the lock
448 add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16
449 add r19=IA64_TASK_SIGNAL_OFFSET,r16
450 cmp4.eq p6,p0=SIG_BLOCK,r32
452 ld8 r19=[r19] // r19 <- current->signal
453 cmp4.eq p7,p0=SIG_UNBLOCK,r32
454 cmp4.eq p8,p0=SIG_SETMASK,r32
456 ld8 r18=[r18] // r18 <- current->pending.signal
457 .pred.rel.mutex p6,p7,p8
458 (p6) or r14=r3,r14 // SIG_BLOCK
459 (p7) andcm r14=r3,r14 // SIG_UNBLOCK
461 (p8) mov r14=r14 // SIG_SETMASK
462 (p6) mov r8=0 // clear error code
463 // recalc_sigpending()
464 add r17=IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,r19
466 add r19=IA64_SIGNAL_SHARED_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r19
468 ld4 r17=[r17] // r17 <- current->signal->group_stop_count
469 (p7) mov r8=0 // clear error code
471 ld8 r19=[r19] // r19 <- current->signal->shared_pending
473 cmp4.gt p6,p7=r17,r0 // p6/p7 <- (current->signal->group_stop_count > 0)?
474 (p8) mov r8=0 // clear error code
476 or r18=r18,r19 // r18 <- current->pending | current->signal->shared_pending
478 // r18 <- (current->pending | current->signal->shared_pending) & ~current->blocked:
480 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
483 (p7) cmp.ne.or.andcm p6,p7=r18,r0 // p6/p7 <- signal pending
484 mov r19=0 // i must not leak kernel bits...
485 (p6) br.cond.dpnt.many .sig_pending
488 1: ld4 r17=[r9] // r17 <- current->thread_info->flags
491 and r18=~_TIF_SIGPENDING,r17 // r18 <- r17 & ~(1 << TIF_SIGPENDING)
494 st8 [r2]=r14 // update current->blocked with new mask
495 cmpxchg4.acq r8=[r9],r18,ar.ccv // current->thread_info->flags <- r18
497 cmp.ne p6,p0=r17,r8 // update failed?
498 (p6) br.cond.spnt.few 1b // yes -> retry
501 // __ticket_spin_unlock(r31)
503 mov r20=0 // i must not leak kernel bits...
505 SSM_PSR_I(p0, p9, r31)
508 srlz.d // ensure psr.i is set again
509 mov r18=0 // i must not leak kernel bits...
512 EX(.fail_efault, (p15) probe.w.fault r34, 3) // verify user has write-access to *oset
513 EX(.fail_efault, (p15) st8 [r34]=r3)
514 mov r2=0 // i must not leak kernel bits...
515 mov r3=0 // i must not leak kernel bits...
517 mov r9=0 // i must not leak kernel bits...
518 mov r14=0 // i must not leak kernel bits...
519 mov r17=0 // i must not leak kernel bits...
520 mov r31=0 // i must not leak kernel bits...
525 // __ticket_spin_unlock(r31)
526 st2.rel [r31]=r20 // release the lock
528 SSM_PSR_I(p0, p9, r17)
531 br.sptk.many fsys_fallback_syscall // with signal pending, do the heavy-weight syscall
535 /* Rather than spinning here, fall back on doing a heavy-weight syscall. */
536 SSM_PSR_I(p0, p9, r17)
539 br.sptk.many fsys_fallback_syscall
541 END(fsys_rt_sigprocmask)
544 * fsys_getcpu doesn't use the third parameter in this implementation. It reads
545 * current_thread_info()->cpu and corresponding node in cpu_to_node_map.
552 add r2=TI_FLAGS+IA64_TASK_SIZE,r16
553 tnat.nz p6,p0 = r32 // guard against NaT argument
554 add r3=TI_CPU+IA64_TASK_SIZE,r16
556 ld4 r3=[r3] // M r3 = thread_info->cpu
557 ld4 r2=[r2] // M r2 = thread_info->flags
558 (p6) br.cond.spnt.few .fail_einval // B
560 tnat.nz p7,p0 = r33 // I guard against NaT argument
561 (p7) br.cond.spnt.few .fail_einval // B
563 movl r17=cpu_to_node_map
565 EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
566 EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
569 ld2 r20=[r18] // r20 = cpu_to_node_map[cpu]
570 and r2 = TIF_ALLWORK_MASK,r2
573 (p8) br.spnt.many fsys_fallback_syscall
576 EX(.fail_efault, st4 [r32] = r3)
577 EX(.fail_efault, st2 [r33] = r20)
581 EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
582 EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
583 and r2 = TIF_ALLWORK_MASK,r2
586 (p8) br.spnt.many fsys_fallback_syscall
588 EX(.fail_efault, st4 [r32] = r3)
589 EX(.fail_efault, st2 [r33] = r0)
596 ENTRY(fsys_fallback_syscall)
601 * We only get here from light-weight syscall handlers. Thus, we already
602 * know that r15 contains a valid syscall number. No need to re-check.
605 movl r14=sys_call_table
607 RSM_PSR_I(p0, r26, r27)
610 ld8 r18=[r18] // load normal (heavy-weight) syscall entry-point
611 MOV_FROM_PSR(p0, r29, r26) // read psr (12 cyc load latency)
615 END(fsys_fallback_syscall)
617 GLOBAL_ENTRY(paravirt_fsys_bubble_down)
622 * We get here for syscalls that don't have a lightweight
623 * handler. For those, we need to bubble down into the kernel
624 * and that requires setting up a minimal pt_regs structure,
625 * and initializing the CPU state more or less as if an
626 * interruption had occurred. To make syscall-restarts work,
627 * we setup pt_regs such that cr_iip points to the second
628 * instruction in syscall_via_break. Decrementing the IP
629 * hence will restart the syscall via break and not
630 * decrementing IP will return us to the caller, as usual.
631 * Note that we preserve the value of psr.pp rather than
632 * initializing it from dcr.pp. This makes it possible to
633 * distinguish fsyscall execution from other privileged
637 * - normal fsyscall handler register usage, except
639 * - r18: address of syscall entry point
645 * We used to clear some PSR bits here but that requires slow
646 * serialization. Fortuntely, that isn't really necessary.
647 * The rationale is as follows: we used to clear bits
648 * ~PSR_PRESERVED_BITS in PSR.L. Since
649 * PSR_PRESERVED_BITS==PSR.{UP,MFL,MFH,PK,DT,PP,SP,RT,IC}, we
650 * ended up clearing PSR.{BE,AC,I,DFL,DFH,DI,DB,SI,TB}.
653 * PSR.BE : already is turned off in __kernel_syscall_via_epc()
654 * PSR.AC : don't care (kernel normally turns PSR.AC on)
655 * PSR.I : already turned off by the time paravirt_fsys_bubble_down gets
657 * PSR.DFL: always 0 (kernel never turns it on)
658 * PSR.DFH: don't care --- kernel never touches f32-f127 on its own
660 * PSR.DI : always 0 (kernel never turns it on)
661 * PSR.SI : always 0 (kernel never turns it on)
662 * PSR.DB : don't care --- kernel never enables kernel-level
664 * PSR.TB : must be 0 already; if it wasn't zero on entry to
665 * __kernel_syscall_via_epc, the branch to paravirt_fsys_bubble_down
666 * will trigger a taken branch; the taken-trap-handler then
667 * converts the syscall into a break-based system-call.
670 * Reading psr.l gives us only bits 0-31, psr.it, and psr.mc.
671 * The rest we have to synthesize.
673 # define PSR_ONE_BITS ((3 << IA64_PSR_CPL0_BIT) \
674 | (0x1 << IA64_PSR_RI_BIT) \
675 | IA64_PSR_BN | IA64_PSR_I)
678 movl r14=ia64_ret_from_syscall // X
681 movl r28=__kernel_syscall_via_break // X create cr.iip
684 mov r2=r16 // A get task addr to addl-addressable register
685 adds r16=IA64_TASK_THREAD_ON_USTACK_OFFSET,r16 // A
686 mov r31=pr // I0 save pr (2 cyc)
688 st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag
689 addl r22=IA64_RBS_OFFSET,r2 // A compute base of RBS
690 add r3=TI_FLAGS+IA64_TASK_SIZE,r2 // A
692 ld4 r3=[r3] // M0|1 r3 = current_thread_info()->flags
693 lfetch.fault.excl.nt1 [r22] // M0|1 prefetch register backing-store
696 mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0
697 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
698 MOV_FROM_ITC(p0, p6, r30, r23) // M get cycle for accounting
704 mov r23=ar.bspstore // M2 (12 cyc) save ar.bspstore
705 mov.m r24=ar.rnat // M2 (5 cyc) read ar.rnat (dual-issues!)
708 mov ar.bspstore=r22 // M2 (6 cyc) switch to kernel RBS
709 movl r8=PSR_ONE_BITS // X
711 mov r25=ar.unat // M2 (5 cyc) save ar.unat
712 mov r19=b6 // I0 save b6 (2 cyc)
713 mov r20=r1 // A save caller's gp in r20
715 or r29=r8,r29 // A construct cr.ipsr value to save
716 mov b6=r18 // I0 copy syscall entry-point to b6 (7 cyc)
717 addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r2 // A compute base of memory stack
719 mov r18=ar.bsp // M2 save (kernel) ar.bsp (12 cyc)
720 cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1
721 br.call.sptk.many b7=ia64_syscall_setup // B
723 #ifdef CONFIG_VIRT_CPU_ACCOUNTING
724 // mov.m r30=ar.itc is called in advance
725 add r16=TI_AC_STAMP+IA64_TASK_SIZE,r2
726 add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r2
728 ld8 r18=[r16],TI_AC_STIME-TI_AC_STAMP // time at last check in kernel
729 ld8 r19=[r17],TI_AC_UTIME-TI_AC_LEAVE // time at leave kernel
731 ld8 r20=[r16],TI_AC_STAMP-TI_AC_STIME // cumulated stime
732 ld8 r21=[r17] // cumulated utime
733 sub r22=r19,r18 // stime before leave kernel
735 st8 [r16]=r30,TI_AC_STIME-TI_AC_STAMP // update stamp
736 sub r18=r30,r19 // elapsed time in user mode
738 add r20=r20,r22 // sum stime
739 add r21=r21,r18 // sum utime
741 st8 [r16]=r20 // update stime
742 st8 [r17]=r21 // update utime
745 mov ar.rsc=0x3 // M2 set eager mode, pl 0, LE, loadrs=0
746 mov rp=r14 // I0 set the real return addr
747 and r3=_TIF_SYSCALL_TRACEAUDIT,r3 // A
749 SSM_PSR_I(p0, p6, r22) // M2 we're on kernel stacks now, reenable irqs
750 cmp.eq p8,p0=r3,r0 // A
751 (p10) br.cond.spnt.many ia64_ret_from_syscall // B return if bad call-frame or r15 is a NaT
754 (p8) br.call.sptk.many b6=b6 // B (ignore return address)
755 br.cond.spnt ia64_trace_syscall // B
756 END(paravirt_fsys_bubble_down)
760 .globl paravirt_fsyscall_table
762 data8 paravirt_fsys_bubble_down
763 paravirt_fsyscall_table:
764 data8 fsys_ni_syscall
765 data8 0 // exit // 1025
770 data8 0 // creat // 1030
775 data8 0 // fchdir // 1035
780 data8 0 // lseek // 1040
781 data8 fsys_getpid // getpid
782 data8 fsys_getppid // getppid
785 data8 0 // setuid // 1045
790 data8 0 // sync // 1050
795 data8 0 // mkdir // 1055
800 data8 0 // brk // 1060
805 data8 0 // ioctl // 1065
810 data8 0 // dup2 // 1070
815 data8 0 // getresgid // 1075
820 data8 0 // setpgid // 1080
823 data8 0 // sethostname
825 data8 0 // getrlimit // 1085
827 data8 fsys_gettimeofday // gettimeofday
828 data8 0 // settimeofday
830 data8 0 // poll // 1090
835 data8 0 // swapoff // 1095
840 data8 0 // fchown // 1100
841 data8 0 // getpriority
842 data8 0 // setpriority
845 data8 0 // gettid // 1105
850 data8 0 // msgsnd // 1110
855 data8 0 // shmdt // 1115
865 data8 0 // remap_file_pages // 1125
869 data8 0 // setdomainname
870 data8 0 // newuname // 1130
873 data8 0 // init_module
874 data8 0 // delete_module
880 data8 0 // personality // 1140
881 data8 0 // afs_syscall
885 data8 0 // flock // 1145
890 data8 0 // sysctl // 1150
895 data8 0 // mprotect // 1155
899 data8 0 // munlockall
900 data8 0 // sched_getparam // 1160
901 data8 0 // sched_setparam
902 data8 0 // sched_getscheduler
903 data8 0 // sched_setscheduler
904 data8 0 // sched_yield
905 data8 0 // sched_get_priority_max // 1165
906 data8 0 // sched_get_priority_min
907 data8 0 // sched_rr_get_interval
909 data8 0 // nfsservctl
910 data8 0 // prctl // 1170
911 data8 0 // getpagesize
913 data8 0 // pciconfig_read
914 data8 0 // pciconfig_write
915 data8 0 // perfmonctl // 1175
916 data8 0 // sigaltstack
917 data8 0 // rt_sigaction
918 data8 0 // rt_sigpending
919 data8 fsys_rt_sigprocmask // rt_sigprocmask
920 data8 0 // rt_sigqueueinfo // 1180
921 data8 0 // rt_sigreturn
922 data8 0 // rt_sigsuspend
923 data8 0 // rt_sigtimedwait
925 data8 0 // capget // 1185
930 data8 0 // socket // 1190
935 data8 0 // getsockname // 1195
936 data8 0 // getpeername
937 data8 0 // socketpair
940 data8 0 // recv // 1200
943 data8 0 // setsockopt
944 data8 0 // getsockopt
945 data8 0 // sendmsg // 1205
947 data8 0 // pivot_root
950 data8 0 // newstat // 1210
954 data8 0 // getdents64
955 data8 0 // getunwind // 1215
960 data8 0 // getxattr // 1220
964 data8 0 // llistxattr
965 data8 0 // flistxattr // 1225
966 data8 0 // removexattr
967 data8 0 // lremovexattr
968 data8 0 // fremovexattr
970 data8 0 // futex // 1230
971 data8 0 // sched_setaffinity
972 data8 0 // sched_getaffinity
973 data8 fsys_set_tid_address // set_tid_address
974 data8 0 // fadvise64_64
975 data8 0 // tgkill // 1235
976 data8 0 // exit_group
977 data8 0 // lookup_dcookie
979 data8 0 // io_destroy
980 data8 0 // io_getevents // 1240
983 data8 0 // epoll_create
985 data8 0 // epoll_wait // 1245
986 data8 0 // restart_syscall
987 data8 0 // semtimedop
988 data8 0 // timer_create
989 data8 0 // timer_settime
990 data8 0 // timer_gettime // 1250
991 data8 0 // timer_getoverrun
992 data8 0 // timer_delete
993 data8 0 // clock_settime
994 data8 fsys_clock_gettime // clock_gettime
995 data8 0 // clock_getres // 1255
996 data8 0 // clock_nanosleep
1000 data8 0 // get_mempolicy // 1260
1001 data8 0 // set_mempolicy
1003 data8 0 // mq_unlink
1004 data8 0 // mq_timedsend
1005 data8 0 // mq_timedreceive // 1265
1006 data8 0 // mq_notify
1007 data8 0 // mq_getsetattr
1008 data8 0 // kexec_load
1010 data8 0 // waitid // 1270
1012 data8 0 // request_key
1014 data8 0 // ioprio_set
1015 data8 0 // ioprio_get // 1275
1016 data8 0 // move_pages
1017 data8 0 // inotify_init
1018 data8 0 // inotify_add_watch
1019 data8 0 // inotify_rm_watch
1020 data8 0 // migrate_pages // 1280
1025 data8 0 // futimesat // 1285
1026 data8 0 // newfstatat
1030 data8 0 // symlinkat // 1290
1031 data8 0 // readlinkat
1033 data8 0 // faccessat
1038 data8 0 // set_robust_list
1039 data8 0 // get_robust_list
1040 data8 0 // sync_file_range // 1300
1044 data8 fsys_getcpu // getcpu // 1304
1046 // fill in zeros for the remaining entries
1048 .space paravirt_fsyscall_table + 8*NR_syscalls - .zero, 0