processor.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef _ASM_M32R_PROCESSOR_H
  2. #define _ASM_M32R_PROCESSOR_H
  3. /*
  4. * include/asm-m32r/processor.h
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. *
  10. * Copyright (C) 1994 Linus Torvalds
  11. * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto
  12. * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
  13. */
  14. #include <linux/kernel.h>
  15. #include <asm/cache.h>
  16. #include <asm/ptrace.h> /* pt_regs */
  17. /*
  18. * Default implementation of macro that returns current
  19. * instruction pointer ("program counter").
  20. */
  21. #define current_text_addr() ({ __label__ _l; _l: &&_l; })
  22. /*
  23. * CPU type and hardware bug flags. Kept separately for each CPU.
  24. * Members of this structure are referenced in head.S, so think twice
  25. * before touching them. [mj]
  26. */
  27. struct cpuinfo_m32r {
  28. unsigned long pgtable_cache_sz;
  29. unsigned long cpu_clock;
  30. unsigned long bus_clock;
  31. unsigned long timer_divide;
  32. unsigned long loops_per_jiffy;
  33. };
  34. /*
  35. * capabilities of CPUs
  36. */
  37. extern struct cpuinfo_m32r boot_cpu_data;
  38. #ifdef CONFIG_SMP
  39. extern struct cpuinfo_m32r cpu_data[];
  40. #define current_cpu_data cpu_data[smp_processor_id()]
  41. #else
  42. #define cpu_data (&boot_cpu_data)
  43. #define current_cpu_data boot_cpu_data
  44. #endif
  45. /*
  46. * User space process size: 2GB (default).
  47. */
  48. #ifdef CONFIG_MMU
  49. #define TASK_SIZE (0x80000000UL)
  50. #else
  51. #define TASK_SIZE (0x00400000UL)
  52. #endif
  53. #ifdef __KERNEL__
  54. #define STACK_TOP TASK_SIZE
  55. #define STACK_TOP_MAX STACK_TOP
  56. #endif
  57. /* This decides where the kernel will search for a free chunk of vm
  58. * space during mmap's.
  59. */
  60. #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
  61. typedef struct {
  62. unsigned long seg;
  63. } mm_segment_t;
  64. #define MAX_TRAPS 10
  65. struct debug_trap {
  66. int nr_trap;
  67. unsigned long addr[MAX_TRAPS];
  68. unsigned long insn[MAX_TRAPS];
  69. };
  70. struct thread_struct {
  71. unsigned long address;
  72. unsigned long trap_no; /* Trap number */
  73. unsigned long error_code; /* Error code of trap */
  74. unsigned long lr; /* saved pc */
  75. unsigned long sp; /* user stack pointer */
  76. struct debug_trap debug_trap;
  77. };
  78. #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
  79. #define INIT_THREAD { \
  80. .sp = INIT_SP, \
  81. }
  82. /*
  83. * Do necessary setup to start up a newly executed thread.
  84. */
  85. /* User process Backup PSW */
  86. #define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM)
  87. #define start_thread(regs, new_pc, new_spu) \
  88. do { \
  89. regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \
  90. regs->bpc = new_pc; \
  91. regs->spu = new_spu; \
  92. } while (0)
  93. /* Forward declaration, a strange C thing */
  94. struct task_struct;
  95. struct mm_struct;
  96. /* Free all resources held by a thread. */
  97. extern void release_thread(struct task_struct *);
  98. /* Copy and release all segment info associated with a VM */
  99. extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
  100. extern void release_segments(struct mm_struct * mm);
  101. extern unsigned long thread_saved_pc(struct task_struct *);
  102. /* Copy and release all segment info associated with a VM */
  103. #define copy_segments(p, mm) do { } while (0)
  104. #define release_segments(mm) do { } while (0)
  105. unsigned long get_wchan(struct task_struct *p);
  106. #define KSTK_EIP(tsk) ((tsk)->thread.lr)
  107. #define KSTK_ESP(tsk) ((tsk)->thread.sp)
  108. #define cpu_relax() barrier()
  109. #define cpu_relax_lowlatency() cpu_relax()
  110. #endif /* _ASM_M32R_PROCESSOR_H */