processor.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * include/asm-alpha/processor.h
  3. *
  4. * Copyright (C) 1994 Linus Torvalds
  5. */
  6. #ifndef __ASM_ALPHA_PROCESSOR_H
  7. #define __ASM_ALPHA_PROCESSOR_H
  8. #include <linux/personality.h> /* for ADDR_LIMIT_32BIT */
  9. /*
  10. * Returns current instruction pointer ("program counter").
  11. */
  12. #define current_text_addr() \
  13. ({ void *__pc; __asm__ ("br %0,.+4" : "=r"(__pc)); __pc; })
  14. /*
  15. * We have a 42-bit user address space: 4TB user VM...
  16. */
  17. #define TASK_SIZE (0x40000000000UL)
  18. /* This decides where the kernel will search for a free chunk of vm
  19. * space during mmap's.
  20. */
  21. #define TASK_UNMAPPED_BASE \
  22. ((current->personality & ADDR_LIMIT_32BIT) ? 0x40000000 : TASK_SIZE / 2)
  23. typedef struct {
  24. unsigned long seg;
  25. } mm_segment_t;
  26. /* This is dead. Everything has been moved to thread_info. */
  27. struct thread_struct { };
  28. #define INIT_THREAD { }
  29. /* Return saved PC of a blocked thread. */
  30. struct task_struct;
  31. extern unsigned long thread_saved_pc(struct task_struct *);
  32. /* Do necessary setup to start up a newly executed thread. */
  33. extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
  34. /* Free all resources held by a thread. */
  35. extern void release_thread(struct task_struct *);
  36. /* Prepare to copy thread state - unlazy all lazy status */
  37. #define prepare_to_copy(tsk) do { } while (0)
  38. /* Create a kernel thread without removing it from tasklists. */
  39. extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  40. unsigned long get_wchan(struct task_struct *p);
  41. /* See arch/alpha/kernel/ptrace.c for details. */
  42. #define PT_REG(reg) \
  43. (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg))
  44. #define SW_REG(reg) \
  45. (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \
  46. + offsetof(struct switch_stack, reg))
  47. #define KSTK_EIP(tsk) \
  48. (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info)))
  49. #define KSTK_ESP(tsk) \
  50. ((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp)
  51. #define cpu_relax() barrier()
  52. #define ARCH_HAS_PREFETCH
  53. #define ARCH_HAS_PREFETCHW
  54. #define ARCH_HAS_SPINLOCK_PREFETCH
  55. #ifndef CONFIG_SMP
  56. /* Nothing to prefetch. */
  57. #define spin_lock_prefetch(lock) do { } while (0)
  58. #endif
  59. #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
  60. extern inline void prefetch(const void *ptr)
  61. {
  62. __builtin_prefetch(ptr, 0, 3);
  63. }
  64. extern inline void prefetchw(const void *ptr)
  65. {
  66. __builtin_prefetch(ptr, 1, 3);
  67. }
  68. #ifdef CONFIG_SMP
  69. extern inline void spin_lock_prefetch(const void *ptr)
  70. {
  71. __builtin_prefetch(ptr, 1, 3);
  72. }
  73. #endif
  74. #else
  75. extern inline void prefetch(const void *ptr)
  76. {
  77. __asm__ ("ldl $31,%0" : : "m"(*(char *)ptr));
  78. }
  79. extern inline void prefetchw(const void *ptr)
  80. {
  81. __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr));
  82. }
  83. #ifdef CONFIG_SMP
  84. extern inline void spin_lock_prefetch(const void *ptr)
  85. {
  86. __asm__ ("ldq $31,%0" : : "m"(*(char *)ptr));
  87. }
  88. #endif
  89. #endif /* GCC 3.1 */
  90. #endif /* __ASM_ALPHA_PROCESSOR_H */