processor.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * include/asm-m68k/processor.h
  3. *
  4. * Copyright (C) 1995 Hamish Macdonald
  5. */
  6. #ifndef __ASM_M68K_PROCESSOR_H
  7. #define __ASM_M68K_PROCESSOR_H
  8. /*
  9. * Default implementation of macro that returns current
  10. * instruction pointer ("program counter").
  11. */
  12. #define current_text_addr() ({ __label__ _l; _l: &&_l;})
  13. #include <linux/config.h>
  14. #include <linux/thread_info.h>
  15. #include <asm/segment.h>
  16. #include <asm/fpu.h>
  17. #include <asm/ptrace.h>
  18. static inline unsigned long rdusp(void)
  19. {
  20. unsigned long usp;
  21. __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
  22. return usp;
  23. }
  24. static inline void wrusp(unsigned long usp)
  25. {
  26. __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
  27. }
  28. /*
  29. * User space process size: 3.75GB. This is hardcoded into a few places,
  30. * so don't change it unless you know what you are doing.
  31. */
  32. #ifndef CONFIG_SUN3
  33. #define TASK_SIZE (0xF0000000UL)
  34. #else
  35. #ifdef __ASSEMBLY__
  36. #define TASK_SIZE (0x0E000000)
  37. #else
  38. #define TASK_SIZE (0x0E000000UL)
  39. #endif
  40. #endif
  41. /* This decides where the kernel will search for a free chunk of vm
  42. * space during mmap's.
  43. */
  44. #ifndef CONFIG_SUN3
  45. #define TASK_UNMAPPED_BASE 0xC0000000UL
  46. #else
  47. #define TASK_UNMAPPED_BASE 0x0A000000UL
  48. #endif
  49. #define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
  50. struct thread_struct {
  51. unsigned long ksp; /* kernel stack pointer */
  52. unsigned long usp; /* user stack pointer */
  53. unsigned short sr; /* saved status register */
  54. unsigned short fs; /* saved fs (sfc, dfc) */
  55. unsigned long crp[2]; /* cpu root pointer */
  56. unsigned long esp0; /* points to SR of stack frame */
  57. unsigned long faddr; /* info about last fault */
  58. int signo, code;
  59. unsigned long fp[8*3];
  60. unsigned long fpcntl[3]; /* fp control regs */
  61. unsigned char fpstate[FPSTATESIZE]; /* floating point state */
  62. struct thread_info info;
  63. };
  64. #define INIT_THREAD { \
  65. ksp: sizeof(init_stack) + (unsigned long) init_stack, \
  66. sr: PS_S, \
  67. fs: __KERNEL_DS, \
  68. info: INIT_THREAD_INFO(init_task) \
  69. }
  70. /*
  71. * Do necessary setup to start up a newly executed thread.
  72. */
  73. static inline void start_thread(struct pt_regs * regs, unsigned long pc,
  74. unsigned long usp)
  75. {
  76. /* reads from user space */
  77. set_fs(USER_DS);
  78. regs->pc = pc;
  79. regs->sr &= ~0x2000;
  80. wrusp(usp);
  81. }
  82. /* Forward declaration, a strange C thing */
  83. struct task_struct;
  84. /* Free all resources held by a thread. */
  85. static inline void release_thread(struct task_struct *dead_task)
  86. {
  87. }
  88. /* Prepare to copy thread state - unlazy all lazy status */
  89. #define prepare_to_copy(tsk) do { } while (0)
  90. extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  91. /*
  92. * Free current thread data structures etc..
  93. */
  94. static inline void exit_thread(void)
  95. {
  96. }
  97. extern unsigned long thread_saved_pc(struct task_struct *tsk);
  98. unsigned long get_wchan(struct task_struct *p);
  99. #define KSTK_EIP(tsk) \
  100. ({ \
  101. unsigned long eip = 0; \
  102. if ((tsk)->thread.esp0 > PAGE_SIZE && \
  103. (virt_addr_valid((tsk)->thread.esp0))) \
  104. eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
  105. eip; })
  106. #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
  107. #define cpu_relax() barrier()
  108. #endif