processor.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef _ASM_SCORE_PROCESSOR_H
  2. #define _ASM_SCORE_PROCESSOR_H
  3. #include <linux/cpumask.h>
  4. #include <linux/threads.h>
  5. #include <asm/segment.h>
  6. struct task_struct;
  7. /*
  8. * System setup and hardware flags..
  9. */
  10. extern void (*cpu_wait)(void);
  11. extern unsigned long thread_saved_pc(struct task_struct *tsk);
  12. extern void start_thread(struct pt_regs *regs,
  13. unsigned long pc, unsigned long sp);
  14. extern unsigned long get_wchan(struct task_struct *p);
  15. /*
  16. * Return current * instruction pointer ("program counter").
  17. */
  18. #define current_text_addr() ({ __label__ _l; _l: &&_l; })
  19. #define cpu_relax() barrier()
  20. #define cpu_relax_lowlatency() cpu_relax()
  21. #define release_thread(thread) do {} while (0)
  22. /*
  23. * User space process size: 2GB. This is hardcoded into a few places,
  24. * so don't change it unless you know what you are doing.
  25. */
  26. #define TASK_SIZE 0x7fff8000UL
  27. /*
  28. * This decides where the kernel will search for a free chunk of vm
  29. * space during mmap's.
  30. */
  31. #define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
  32. #ifdef __KERNEL__
  33. #define STACK_TOP TASK_SIZE
  34. #define STACK_TOP_MAX TASK_SIZE
  35. #endif
  36. /*
  37. * If you change thread_struct remember to change the #defines below too!
  38. */
  39. struct thread_struct {
  40. unsigned long reg0, reg2, reg3;
  41. unsigned long reg12, reg13, reg14, reg15, reg16;
  42. unsigned long reg17, reg18, reg19, reg20, reg21;
  43. unsigned long cp0_psr;
  44. unsigned long cp0_ema; /* Last user fault */
  45. unsigned long cp0_badvaddr; /* Last user fault */
  46. unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
  47. unsigned long error_code;
  48. unsigned long trap_no;
  49. unsigned long mflags;
  50. unsigned long reg29;
  51. unsigned long single_step;
  52. unsigned long ss_nextcnt;
  53. unsigned long insn1_type;
  54. unsigned long addr1;
  55. unsigned long insn1;
  56. unsigned long insn2_type;
  57. unsigned long addr2;
  58. unsigned long insn2;
  59. mm_segment_t current_ds;
  60. };
  61. #define INIT_THREAD { \
  62. .reg0 = 0, \
  63. .reg2 = 0, \
  64. .reg3 = 0, \
  65. .reg12 = 0, \
  66. .reg13 = 0, \
  67. .reg14 = 0, \
  68. .reg15 = 0, \
  69. .reg16 = 0, \
  70. .reg17 = 0, \
  71. .reg18 = 0, \
  72. .reg19 = 0, \
  73. .reg20 = 0, \
  74. .reg21 = 0, \
  75. .cp0_psr = 0, \
  76. .error_code = 0, \
  77. .trap_no = 0, \
  78. }
  79. #define kstk_tos(tsk) \
  80. ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
  81. #define task_pt_regs(tsk) ((struct pt_regs *)kstk_tos(tsk) - 1)
  82. #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
  83. #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
  84. #endif /* _ASM_SCORE_PROCESSOR_H */