1 #ifndef _ASM_IA64_PROCESSOR_H
2 #define _ASM_IA64_PROCESSOR_H
5 * Copyright (C) 1998-2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 * Stephane Eranian <eranian@hpl.hp.com>
8 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
9 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
11 * 11/24/98 S.Eranian added ia64_set_iva()
12 * 12/03/99 D. Mosberger implement thread_saved_pc() via kernel unwind API
13 * 06/16/00 A. Mallick added csd/ssd/tssd for ia32 support
16 #include <linux/config.h>
18 #include <asm/ptrace.h>
19 #include <asm/kregs.h>
20 #include <asm/ustack.h>
22 #define IA64_NUM_DBG_REGS 8
24 * Limits for PMC and PMD are set to less than maximum architected values
25 * but should be sufficient for a while
27 #define IA64_NUM_PMC_REGS 32
28 #define IA64_NUM_PMD_REGS 32
30 #define DEFAULT_MAP_BASE 0x2000000000000000
31 #define DEFAULT_TASK_SIZE 0xa000000000000000
34 * TASK_SIZE really is a mis-named. It really is the maximum user
35 * space address (plus one). On IA-64, there are five regions of 2TB
36 * each (assuming 8KB page size), for a total of 8TB of user virtual
39 #define TASK_SIZE (current->thread.task_size)
42 * MM_VM_SIZE(mm) gives the maximum address (plus 1) which may contain a mapping for
43 * address-space MM. Note that with 32-bit tasks, this is still DEFAULT_TASK_SIZE,
44 * because the kernel may have installed helper-mappings above TASK_SIZE. For example,
45 * for x86 emulation, the LDT and GDT are mapped above TASK_SIZE.
47 #define MM_VM_SIZE(mm) DEFAULT_TASK_SIZE
50 * This decides where the kernel will search for a free chunk of vm
51 * space during mmap's.
53 #define TASK_UNMAPPED_BASE (current->thread.map_base)
60 #define MCA_bus__is_a_macro /* for versions in ksyms.c */
62 #define IA64_THREAD_FPH_VALID (__IA64_UL(1) << 0) /* floating-point high state valid? */
63 #define IA64_THREAD_DBG_VALID (__IA64_UL(1) << 1) /* debug registers valid? */
64 #define IA64_THREAD_PM_VALID (__IA64_UL(1) << 2) /* performance registers valid? */
65 #define IA64_THREAD_UAC_NOPRINT (__IA64_UL(1) << 3) /* don't log unaligned accesses */
66 #define IA64_THREAD_UAC_SIGBUS (__IA64_UL(1) << 4) /* generate SIGBUS on unaligned acc. */
67 #define IA64_THREAD_KRBS_SYNCED (__IA64_UL(1) << 5) /* krbs synced with process vm? */
68 #define IA64_THREAD_FPEMU_NOPRINT (__IA64_UL(1) << 6) /* don't log any fpswa faults */
69 #define IA64_THREAD_FPEMU_SIGFPE (__IA64_UL(1) << 7) /* send a SIGFPE for fpswa faults */
70 #define IA64_THREAD_XSTACK (__IA64_UL(1) << 8) /* stack executable by default? */
72 #define IA64_THREAD_UAC_SHIFT 3
73 #define IA64_THREAD_UAC_MASK (IA64_THREAD_UAC_NOPRINT | IA64_THREAD_UAC_SIGBUS)
74 #define IA64_THREAD_FPEMU_SHIFT 6
75 #define IA64_THREAD_FPEMU_MASK (IA64_THREAD_FPEMU_NOPRINT | IA64_THREAD_FPEMU_SIGFPE)
79 * This shift should be large enough to be able to represent 1000000000/itc_freq with good
80 * accuracy while being small enough to fit 10*1000000000<<IA64_NSEC_PER_CYC_SHIFT in 64 bits
81 * (this will give enough slack to represent 10 seconds worth of time as a scaled number).
83 #define IA64_NSEC_PER_CYC_SHIFT 30
87 #include <linux/cache.h>
88 #include <linux/compiler.h>
89 #include <linux/threads.h>
90 #include <linux/types.h>
94 #include <asm/percpu.h>
96 #include <asm/unwind.h>
97 #include <asm/atomic.h>
99 #include <asm/nodedata.h>
102 /* like above but expressed as bitfields for more efficient access: */
138 __u64 reserved4
: 19;
142 * CPU type, hardware bug flags, and per-CPU state. Frequently used
143 * state comes earlier:
145 struct cpuinfo_ia64
{
146 /* irq_stat must be 64-bit aligned */
152 __u64 irq_and_bh_counts
;
154 __u32 softirq_pending
;
155 __u64 itm_delta
; /* # of clock cycles between clock ticks */
156 __u64 itm_next
; /* interval timer mask value to use for next clock tick */
159 __u64 pgtable_cache_sz
;
160 /* CPUID-derived information: */
169 __u64 itc_freq
; /* frequency of ITC counter */
170 __u64 proc_freq
; /* frequency of processor */
171 __u64 cyc_per_usec
; /* itc_freq/1000000 */
172 __u64 nsec_per_cyc
; /* (1000000000<<IA64_NSEC_PER_CYC_SHIFT)/itc_freq */
173 __u64 unimpl_va_mask
; /* mask of unimplemented virtual address bits (from PAL) */
174 __u64 unimpl_pa_mask
; /* mask of unimplemented physical address bits (from PAL) */
177 __u32 ptce_stride
[2];
178 struct task_struct
*ksoftirqd
; /* kernel softirq daemon for this CPU */
181 __u64 loops_per_jiffy
;
184 __u64 prof_multiplier
;
187 struct ia64_node_data
*node_data
;
191 DECLARE_PER_CPU(struct cpuinfo_ia64
, cpu_info
);
194 * The "local" data pointer. It points to the per-CPU data of the currently executing
195 * CPU, much like "current" points to the per-task data of the currently executing task.
197 #define local_cpu_data (&__get_cpu_var(cpu_info))
198 #define cpu_data(cpu) (&per_cpu(cpu_info, cpu))
200 extern void identify_cpu (struct cpuinfo_ia64
*);
201 extern void print_cpu_info (struct cpuinfo_ia64
*);
207 #define SET_UNALIGN_CTL(task,value) \
209 (task)->thread.flags = (((task)->thread.flags & ~IA64_THREAD_UAC_MASK) \
210 | (((value) << IA64_THREAD_UAC_SHIFT) & IA64_THREAD_UAC_MASK)); \
213 #define GET_UNALIGN_CTL(task,addr) \
215 put_user(((task)->thread.flags & IA64_THREAD_UAC_MASK) >> IA64_THREAD_UAC_SHIFT, \
219 #define SET_FPEMU_CTL(task,value) \
221 (task)->thread.flags = (((task)->thread.flags & ~IA64_THREAD_FPEMU_MASK) \
222 | (((value) << IA64_THREAD_FPEMU_SHIFT) & IA64_THREAD_FPEMU_MASK)); \
225 #define GET_FPEMU_CTL(task,addr) \
227 put_user(((task)->thread.flags & IA64_THREAD_FPEMU_MASK) >> IA64_THREAD_FPEMU_SHIFT, \
231 struct thread_struct
{
232 __u32 flags
; /* various thread flags (see IA64_THREAD_*) */
233 /* writing on_ustack is performance-critical, so it's worth spending 8 bits on it... */
234 __u8 on_ustack
; /* executing on user-stacks? */
236 __u64 ksp
; /* kernel stack pointer */
237 __u64 map_base
; /* base address for get_unmapped_area() */
238 __u64 task_size
; /* limit for task size */
239 __u64 rbs_bot
; /* the base address for the RBS */
240 int last_fph_cpu
; /* CPU that may hold the contents of f32-f127 */
242 #ifdef CONFIG_IA32_SUPPORT
243 __u64 eflag
; /* IA32 EFLAGS reg */
244 __u64 fsr
; /* IA32 floating pt status reg */
245 __u64 fcr
; /* IA32 floating pt control reg */
246 __u64 fir
; /* IA32 fp except. instr. reg */
247 __u64 fdr
; /* IA32 fp except. data reg */
248 __u64 old_k1
; /* old value of ar.k1 */
249 __u64 old_iob
; /* old IOBase value */
250 # define INIT_THREAD_IA32 .eflag = 0, \
252 .fcr = 0x17800000037fULL, \
258 # define INIT_THREAD_IA32
259 #endif /* CONFIG_IA32_SUPPORT */
260 #ifdef CONFIG_PERFMON
261 __u64 pmcs
[IA64_NUM_PMC_REGS
];
262 __u64 pmds
[IA64_NUM_PMD_REGS
];
263 void *pfm_context
; /* pointer to detailed PMU context */
264 unsigned long pfm_needs_checking
; /* when >0, pending perfmon work on kernel exit */
265 # define INIT_THREAD_PM .pmcs = {0UL, }, \
267 .pfm_context = NULL, \
268 .pfm_needs_checking = 0UL,
270 # define INIT_THREAD_PM
272 __u64 dbr
[IA64_NUM_DBG_REGS
];
273 __u64 ibr
[IA64_NUM_DBG_REGS
];
274 struct ia64_fpreg fph
[96]; /* saved/loaded on demand */
277 #define INIT_THREAD { \
281 .map_base = DEFAULT_MAP_BASE, \
282 .rbs_bot = DEFAULT_USER_STACK_SIZE, \
283 .task_size = DEFAULT_TASK_SIZE, \
284 .last_fph_cpu = -1, \
292 #define start_thread(regs,new_ip,new_sp) do { \
294 regs->cr_ipsr = ((regs->cr_ipsr | (IA64_PSR_BITS_TO_SET | IA64_PSR_CPL)) \
295 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_RI | IA64_PSR_IS)); \
296 regs->cr_iip = new_ip; \
297 regs->ar_rsc = 0xf; /* eager mode, privilege level 3 */ \
299 regs->ar_bspstore = current->thread.rbs_bot; \
300 regs->ar_fpsr = FPSR_DEFAULT; \
302 regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \
303 regs->r12 = new_sp - 16; /* allocate 16 byte scratch area */ \
304 if (unlikely(!current->mm->dumpable)) { \
306 * Zap scratch regs to avoid leaking bits between processes with different \
309 regs->ar_pfs = 0; regs->b0 = 0; regs->pr = 0; \
310 regs->r1 = 0; regs->r9 = 0; regs->r11 = 0; regs->r13 = 0; regs->r15 = 0; \
314 /* Forward declarations, a strange C thing... */
319 * Free all resources held by a thread. This is called after the
320 * parent of DEAD_TASK has collected the exit status of the task via
323 #define release_thread(dead_task)
325 /* Prepare to copy thread state - unlazy all lazy status */
326 #define prepare_to_copy(tsk) do { } while (0)
329 * This is the mechanism for creating a new kernel thread.
331 * NOTE 1: Only a kernel-only process (ie the swapper or direct
332 * descendants who haven't done an "execve()") should use this: it
333 * will work within a system call from a "real" process, but the
334 * process memory space will not be free'd until both the parent and
335 * the child have exited.
337 * NOTE 2: This MUST NOT be an inlined function. Otherwise, we get
338 * into trouble in init/main.c when the child thread returns to
339 * do_basic_setup() and the timing is such that free_initmem() has
340 * been called already.
342 extern pid_t
kernel_thread (int (*fn
)(void *), void *arg
, unsigned long flags
);
344 /* Get wait channel for task P. */
345 extern unsigned long get_wchan (struct task_struct
*p
);
347 /* Return instruction pointer of blocked task TSK. */
348 #define KSTK_EIP(tsk) \
350 struct pt_regs *_regs = ia64_task_regs(tsk); \
351 _regs->cr_iip + ia64_psr(_regs)->ri; \
354 /* Return stack pointer of blocked task TSK. */
355 #define KSTK_ESP(tsk) ((tsk)->thread.ksp)
357 static inline unsigned long
358 ia64_get_kr (unsigned long regnum
)
363 case 0: asm volatile ("mov %0=ar.k0" : "=r"(r
)); break;
364 case 1: asm volatile ("mov %0=ar.k1" : "=r"(r
)); break;
365 case 2: asm volatile ("mov %0=ar.k2" : "=r"(r
)); break;
366 case 3: asm volatile ("mov %0=ar.k3" : "=r"(r
)); break;
367 case 4: asm volatile ("mov %0=ar.k4" : "=r"(r
)); break;
368 case 5: asm volatile ("mov %0=ar.k5" : "=r"(r
)); break;
369 case 6: asm volatile ("mov %0=ar.k6" : "=r"(r
)); break;
370 case 7: asm volatile ("mov %0=ar.k7" : "=r"(r
)); break;
376 ia64_set_kr (unsigned long regnum
, unsigned long r
)
379 case 0: asm volatile ("mov ar.k0=%0" :: "r"(r
)); break;
380 case 1: asm volatile ("mov ar.k1=%0" :: "r"(r
)); break;
381 case 2: asm volatile ("mov ar.k2=%0" :: "r"(r
)); break;
382 case 3: asm volatile ("mov ar.k3=%0" :: "r"(r
)); break;
383 case 4: asm volatile ("mov ar.k4=%0" :: "r"(r
)); break;
384 case 5: asm volatile ("mov ar.k5=%0" :: "r"(r
)); break;
385 case 6: asm volatile ("mov ar.k6=%0" :: "r"(r
)); break;
386 case 7: asm volatile ("mov ar.k7=%0" :: "r"(r
)); break;
391 * The following three macros can't be inline functions because we don't have struct
392 * task_struct at this point.
395 /* Return TRUE if task T owns the fph partition of the CPU we're running on. */
396 #define ia64_is_local_fpu_owner(t) \
398 struct task_struct *__ia64_islfo_task = (t); \
399 (__ia64_islfo_task->thread.last_fph_cpu == smp_processor_id() \
400 && __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER)); \
403 /* Mark task T as owning the fph partition of the CPU we're running on. */
404 #define ia64_set_local_fpu_owner(t) do { \
405 struct task_struct *__ia64_slfo_task = (t); \
406 __ia64_slfo_task->thread.last_fph_cpu = smp_processor_id(); \
407 ia64_set_kr(IA64_KR_FPU_OWNER, (unsigned long) __ia64_slfo_task); \
410 /* Mark the fph partition of task T as being invalid on all CPUs. */
411 #define ia64_drop_fpu(t) ((t)->thread.last_fph_cpu = -1)
413 extern void __ia64_init_fpu (void);
414 extern void __ia64_save_fpu (struct ia64_fpreg
*fph
);
415 extern void __ia64_load_fpu (struct ia64_fpreg
*fph
);
416 extern void ia64_save_debug_regs (unsigned long *save_area
);
417 extern void ia64_load_debug_regs (unsigned long *save_area
);
419 #ifdef CONFIG_IA32_SUPPORT
420 extern void ia32_save_state (struct task_struct
*task
);
421 extern void ia32_load_state (struct task_struct
*task
);
424 #define ia64_fph_enable() asm volatile (";; rsm psr.dfh;; srlz.d;;" ::: "memory");
425 #define ia64_fph_disable() asm volatile (";; ssm psr.dfh;; srlz.d;;" ::: "memory");
427 /* load fp 0.0 into fph */
429 ia64_init_fpu (void) {
435 /* save f32-f127 at FPH */
437 ia64_save_fpu (struct ia64_fpreg
*fph
) {
439 __ia64_save_fpu(fph
);
443 /* load f32-f127 from FPH */
445 ia64_load_fpu (struct ia64_fpreg
*fph
) {
447 __ia64_load_fpu(fph
);
454 asm volatile ("fc %0" :: "r"(addr
) : "memory");
460 asm volatile (";; sync.i" ::: "memory");
466 asm volatile (";; srlz.i ;;" ::: "memory");
472 asm volatile (";; srlz.d" ::: "memory");
476 ia64_get_rr (__u64 reg_bits
)
479 asm volatile ("mov %0=rr[%1]" : "=r"(r
) : "r"(reg_bits
) : "memory");
484 ia64_set_rr (__u64 reg_bits
, __u64 rr_val
)
486 asm volatile ("mov rr[%0]=%1" :: "r"(reg_bits
), "r"(rr_val
) : "memory");
493 asm volatile ("mov %0=cr.dcr" : "=r"(r
));
498 ia64_set_dcr (__u64 val
)
500 asm volatile ("mov cr.dcr=%0;;" :: "r"(val
) : "memory");
508 asm volatile ("mov %0=cr.lid" : "=r"(r
));
515 asm volatile ("invala" ::: "memory");
522 asm volatile ("mov %0=psr;; rsm psr.i | psr.ic;; srlz.i;;" : "=r"(psr
) :: "memory");
530 ia64_set_psr (__u64 psr
)
532 asm volatile (";; mov psr.l=%0;; srlz.d" :: "r" (psr
) : "memory");
536 * Insert a translation into an instruction and/or data translation
540 ia64_itr (__u64 target_mask
, __u64 tr_num
,
541 __u64 vmaddr
, __u64 pte
,
544 asm volatile ("mov cr.itir=%0" :: "r"(log_page_size
<< 2) : "memory");
545 asm volatile ("mov cr.ifa=%0;;" :: "r"(vmaddr
) : "memory");
546 if (target_mask
& 0x1)
547 asm volatile ("itr.i itr[%0]=%1"
548 :: "r"(tr_num
), "r"(pte
) : "memory");
549 if (target_mask
& 0x2)
550 asm volatile (";;itr.d dtr[%0]=%1"
551 :: "r"(tr_num
), "r"(pte
) : "memory");
555 * Insert a translation into the instruction and/or data translation
559 ia64_itc (__u64 target_mask
, __u64 vmaddr
, __u64 pte
,
562 asm volatile ("mov cr.itir=%0" :: "r"(log_page_size
<< 2) : "memory");
563 asm volatile ("mov cr.ifa=%0;;" :: "r"(vmaddr
) : "memory");
564 /* as per EAS2.6, itc must be the last instruction in an instruction group */
565 if (target_mask
& 0x1)
566 asm volatile ("itc.i %0;;" :: "r"(pte
) : "memory");
567 if (target_mask
& 0x2)
568 asm volatile (";;itc.d %0;;" :: "r"(pte
) : "memory");
572 * Purge a range of addresses from instruction and/or data translation
576 ia64_ptr (__u64 target_mask
, __u64 vmaddr
, __u64 log_size
)
578 if (target_mask
& 0x1)
579 asm volatile ("ptr.i %0,%1" :: "r"(vmaddr
), "r"(log_size
<< 2));
580 if (target_mask
& 0x2)
581 asm volatile ("ptr.d %0,%1" :: "r"(vmaddr
), "r"(log_size
<< 2));
584 /* Set the interrupt vector address. The address must be suitably aligned (32KB). */
586 ia64_set_iva (void *ivt_addr
)
588 asm volatile ("mov cr.iva=%0;; srlz.i;;" :: "r"(ivt_addr
) : "memory");
591 /* Set the page table address and control bits. */
593 ia64_set_pta (__u64 pta
)
595 /* Note: srlz.i implies srlz.d */
596 asm volatile ("mov cr.pta=%0;; srlz.i;;" :: "r"(pta
) : "memory");
600 ia64_get_cpuid (__u64 regnum
)
604 asm ("mov %0=cpuid[%r1]" : "=r"(r
) : "rO"(regnum
));
611 asm ("mov cr.eoi=r0;; srlz.d;;" ::: "memory");
615 ia64_set_lrr0 (unsigned long val
)
617 asm volatile ("mov cr.lrr0=%0;; srlz.d" :: "r"(val
) : "memory");
621 ia64_hint_pause (void)
623 asm volatile ("hint @pause" ::: "memory");
626 #define cpu_relax() ia64_hint_pause()
629 ia64_set_lrr1 (unsigned long val
)
631 asm volatile ("mov cr.lrr1=%0;; srlz.d" :: "r"(val
) : "memory");
635 ia64_set_pmv (__u64 val
)
637 asm volatile ("mov cr.pmv=%0" :: "r"(val
) : "memory");
641 ia64_get_pmc (__u64 regnum
)
645 asm volatile ("mov %0=pmc[%1]" : "=r"(retval
) : "r"(regnum
));
650 ia64_set_pmc (__u64 regnum
, __u64 value
)
652 asm volatile ("mov pmc[%0]=%1" :: "r"(regnum
), "r"(value
));
656 ia64_get_pmd (__u64 regnum
)
660 asm volatile ("mov %0=pmd[%1]" : "=r"(retval
) : "r"(regnum
));
665 ia64_set_pmd (__u64 regnum
, __u64 value
)
667 asm volatile ("mov pmd[%0]=%1" :: "r"(regnum
), "r"(value
));
671 * Given the address to which a spill occurred, return the unat bit
672 * number that corresponds to this address.
675 ia64_unat_pos (void *spill_addr
)
677 return ((__u64
) spill_addr
>> 3) & 0x3f;
681 * Set the NaT bit of an integer register which was spilled at address
682 * SPILL_ADDR. UNAT is the mask to be updated.
685 ia64_set_unat (__u64
*unat
, void *spill_addr
, unsigned long nat
)
687 __u64 bit
= ia64_unat_pos(spill_addr
);
688 __u64 mask
= 1UL << bit
;
690 *unat
= (*unat
& ~mask
) | (nat
<< bit
);
694 * Return saved PC of a blocked thread.
695 * Note that the only way T can block is through a call to schedule() -> switch_to().
697 static inline unsigned long
698 thread_saved_pc (struct task_struct
*t
)
700 struct unw_frame_info info
;
703 unw_init_from_blocked_task(&info
, t
);
704 if (unw_unwind(&info
) < 0)
706 unw_get_ip(&info
, &ip
);
711 * Get the current instruction/program counter value.
713 #define current_text_addr() \
714 ({ void *_pc; asm volatile ("mov %0=ip" : "=r" (_pc)); _pc; })
717 * Set the correctable machine check vector register
720 ia64_set_cmcv (__u64 val
)
722 asm volatile ("mov cr.cmcv=%0" :: "r"(val
) : "memory");
726 * Read the correctable machine check vector register
733 asm volatile ("mov %0=cr.cmcv" : "=r"(val
) :: "memory");
741 asm volatile ("srlz.d;; mov %0=cr.ivr;; srlz.d;;" : "=r"(r
));
746 ia64_set_tpr (__u64 val
)
748 asm volatile ("mov cr.tpr=%0" :: "r"(val
));
755 asm volatile ("mov %0=cr.tpr" : "=r"(r
));
760 ia64_set_irr0 (__u64 val
)
762 asm volatile("mov cr.irr0=%0;;" :: "r"(val
) : "memory");
771 /* this is volatile because irr may change unbeknownst to gcc... */
772 asm volatile("mov %0=cr.irr0" : "=r"(val
));
777 ia64_set_irr1 (__u64 val
)
779 asm volatile("mov cr.irr1=%0;;" :: "r"(val
) : "memory");
788 /* this is volatile because irr may change unbeknownst to gcc... */
789 asm volatile("mov %0=cr.irr1" : "=r"(val
));
794 ia64_set_irr2 (__u64 val
)
796 asm volatile("mov cr.irr2=%0;;" :: "r"(val
) : "memory");
805 /* this is volatile because irr may change unbeknownst to gcc... */
806 asm volatile("mov %0=cr.irr2" : "=r"(val
));
811 ia64_set_irr3 (__u64 val
)
813 asm volatile("mov cr.irr3=%0;;" :: "r"(val
) : "memory");
822 /* this is volatile because irr may change unbeknownst to gcc... */
823 asm volatile ("mov %0=cr.irr3" : "=r"(val
));
832 asm ("mov %0=gp" : "=r"(val
));
837 ia64_set_ibr (__u64 regnum
, __u64 value
)
839 asm volatile ("mov ibr[%0]=%1" :: "r"(regnum
), "r"(value
));
843 ia64_set_dbr (__u64 regnum
, __u64 value
)
845 asm volatile ("mov dbr[%0]=%1" :: "r"(regnum
), "r"(value
));
846 #ifdef CONFIG_ITANIUM
847 asm volatile (";; srlz.d");
852 ia64_get_ibr (__u64 regnum
)
856 asm volatile ("mov %0=ibr[%1]" : "=r"(retval
) : "r"(regnum
));
861 ia64_get_dbr (__u64 regnum
)
865 asm volatile ("mov %0=dbr[%1]" : "=r"(retval
) : "r"(regnum
));
866 #ifdef CONFIG_ITANIUM
867 asm volatile (";; srlz.d");
872 /* XXX remove the handcoded version once we have a sufficiently clever compiler... */
873 #ifdef SMART_COMPILER
874 # define ia64_rotr(w,n) \
876 __u64 _w = (w), _n = (n); \
878 (_w >> _n) | (_w << (64 - _n)); \
881 # define ia64_rotr(w,n) \
884 asm ("shrp %0=%1,%1,%2" : "=r"(result) : "r"(w), "i"(n)); \
889 #define ia64_rotl(w,n) ia64_rotr((w),(64)-(n))
892 ia64_thash (__u64 addr
)
895 asm ("thash %0=%1" : "=r"(result
) : "r" (addr
));
900 ia64_tpa (__u64 addr
)
903 asm ("tpa %0=%1" : "=r"(result
) : "r"(addr
));
908 * Take a mapped kernel address and return the equivalent address
909 * in the region 7 identity mapped virtual area.
912 ia64_imva (void *addr
)
915 asm ("tpa %0=%1" : "=r"(result
) : "r"(addr
));
919 #define ARCH_HAS_PREFETCH
920 #define ARCH_HAS_PREFETCHW
921 #define ARCH_HAS_SPINLOCK_PREFETCH
922 #define PREFETCH_STRIDE 256
925 prefetch (const void *x
)
927 __asm__
__volatile__ ("lfetch [%0]" : : "r"(x
));
931 prefetchw (const void *x
)
933 __asm__
__volatile__ ("lfetch.excl [%0]" : : "r"(x
));
936 #define spin_lock_prefetch(x) prefetchw(x)
938 #endif /* !__ASSEMBLY__ */
940 #endif /* _ASM_IA64_PROCESSOR_H */