processor.h 3.5 KB

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