processor.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1994 Waldorf GMBH
  7. * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
  8. * Copyright (C) 1996 Paul M. Antoine
  9. * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  10. */
  11. #ifndef _ASM_PROCESSOR_H
  12. #define _ASM_PROCESSOR_H
  13. #include <asm/isadep.h>
  14. #include <asm/cachectl.h>
  15. #include <asm/mipsregs.h>
  16. #include <asm/reg.h>
  17. #include <asm/system.h>
  18. /*
  19. * Return current * instruction pointer ("program counter").
  20. */
  21. #define current_text_addr() ({ __label__ _l; _l: &&_l;})
  22. /*
  23. * System setup and hardware flags..
  24. */
  25. extern void (*cpu_wait)(void);
  26. extern unsigned int vced_count, vcei_count;
  27. #define NUM_FPU_REGS 32
  28. typedef __u64 fpureg_t;
  29. /*
  30. * It would be nice to add some more fields for emulator statistics, but there
  31. * are a number of fixed offsets in offset.h and elsewhere that would have to
  32. * be recalculated by hand. So the additional information will be private to
  33. * the FPU emulator for now. See asm-mips/fpu_emulator.h.
  34. */
  35. struct mips_fpu_struct {
  36. fpureg_t fpr[NUM_FPU_REGS];
  37. unsigned int fcr31;
  38. };
  39. #define NUM_DSP_REGS 6
  40. typedef __u32 dspreg_t;
  41. struct mips_dsp_state {
  42. dspreg_t dspr[NUM_DSP_REGS];
  43. unsigned int dspcontrol;
  44. };
  45. typedef struct {
  46. unsigned long seg;
  47. } mm_segment_t;
  48. #define ARCH_MIN_TASKALIGN 8
  49. struct mips_abi;
  50. /*
  51. * If you change thread_struct remember to change the #defines below too!
  52. */
  53. struct thread_struct {
  54. /* Saved main processor registers. */
  55. unsigned long reg16;
  56. unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
  57. unsigned long reg29, reg30, reg31;
  58. /* Saved cp0 stuff. */
  59. unsigned long cp0_status;
  60. /* Saved fpu/fpu emulator stuff. */
  61. struct mips_fpu_struct fpu;
  62. #ifdef CONFIG_MIPS_MT_FPAFF
  63. /* Emulated instruction count */
  64. unsigned long emulated_fp;
  65. /* Saved per-thread scheduler affinity mask */
  66. cpumask_t user_cpus_allowed;
  67. #endif /* CONFIG_MIPS_MT_FPAFF */
  68. /* Saved state of the DSP ASE, if available. */
  69. struct mips_dsp_state dsp;
  70. /* Other stuff associated with the thread. */
  71. unsigned long cp0_badvaddr; /* Last user fault */
  72. unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
  73. unsigned long error_code;
  74. unsigned long trap_no;
  75. unsigned long irix_trampoline; /* Wheee... */
  76. unsigned long irix_oldctx;
  77. struct mips_abi *abi;
  78. };
  79. struct task_struct;
  80. /* Free all resources held by a thread. */
  81. #define release_thread(thread) do { } while(0)
  82. /* Prepare to copy thread state - unlazy all lazy status */
  83. #define prepare_to_copy(tsk) do { } while (0)
  84. #define cpu_relax() barrier()
  85. /*
  86. * Return_address is a replacement for __builtin_return_address(count)
  87. * which on certain architectures cannot reasonably be implemented in GCC
  88. * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
  89. * Note that __builtin_return_address(x>=1) is forbidden because GCC
  90. * aborts compilation on some CPUs. It's simply not possible to unwind
  91. * some CPU's stackframes.
  92. *
  93. * __builtin_return_address works only for non-leaf functions. We avoid the
  94. * overhead of a function call by forcing the compiler to save the return
  95. * address register on the stack.
  96. */
  97. #define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
  98. #ifdef CONFIG_CPU_HAS_PREFETCH
  99. #define ARCH_HAS_PREFETCH
  100. static inline void prefetch(const void *addr)
  101. {
  102. __asm__ __volatile__(
  103. " .set mips4 \n"
  104. " pref %0, (%1) \n"
  105. " .set mips0 \n"
  106. :
  107. : "i" (Pref_Load), "r" (addr));
  108. }
  109. #endif
  110. #endif /* _ASM_PROCESSOR_H */