processor.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. /* This decides where the kernel will search for a free chunk of vm
  54. * space during mmap's.
  55. */
  56. #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
  57. typedef struct {
  58. unsigned long seg;
  59. } mm_segment_t;
  60. #define MAX_TRAPS 10
  61. struct debug_trap {
  62. int nr_trap;
  63. unsigned long addr[MAX_TRAPS];
  64. unsigned long insn[MAX_TRAPS];
  65. };
  66. struct thread_struct {
  67. unsigned long address;
  68. unsigned long trap_no; /* Trap number */
  69. unsigned long error_code; /* Error code of trap */
  70. unsigned long lr; /* saved pc */
  71. unsigned long sp; /* user stack pointer */
  72. struct debug_trap debug_trap;
  73. };
  74. #define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
  75. #define INIT_THREAD { \
  76. .sp = INIT_SP, \
  77. }
  78. /*
  79. * Do necessary setup to start up a newly executed thread.
  80. */
  81. /* User process Backup PSW */
  82. #define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM)
  83. #define start_thread(regs, new_pc, new_spu) \
  84. do { \
  85. set_fs(USER_DS); \
  86. regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \
  87. regs->bpc = new_pc; \
  88. regs->spu = new_spu; \
  89. } while (0)
  90. /* Forward declaration, a strange C thing */
  91. struct task_struct;
  92. struct mm_struct;
  93. /* Free all resources held by a thread. */
  94. extern void release_thread(struct task_struct *);
  95. #define prepare_to_copy(tsk) do { } while (0)
  96. /*
  97. * create a kernel thread without removing it from tasklists
  98. */
  99. extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  100. /* Copy and release all segment info associated with a VM */
  101. extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
  102. extern void release_segments(struct mm_struct * mm);
  103. extern unsigned long thread_saved_pc(struct task_struct *);
  104. /* Copy and release all segment info associated with a VM */
  105. #define copy_segments(p, mm) do { } while (0)
  106. #define release_segments(mm) do { } while (0)
  107. unsigned long get_wchan(struct task_struct *p);
  108. #define KSTK_EIP(tsk) ((tsk)->thread.lr)
  109. #define KSTK_ESP(tsk) ((tsk)->thread.sp)
  110. #define THREAD_SIZE (2*PAGE_SIZE)
  111. #define cpu_relax() barrier()
  112. #endif /* _ASM_M32R_PROCESSOR_H */