processor.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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 task_work {
  51. unsigned char sigpending;
  52. unsigned char notify_resume; /* request for notification on
  53. userspace execution resumption */
  54. char need_resched;
  55. unsigned char delayed_trace; /* single step a syscall */
  56. unsigned char syscall_trace; /* count of syscall interceptors */
  57. unsigned char memdie; /* task was selected to be killed */
  58. unsigned char pad[2];
  59. };
  60. struct thread_struct {
  61. unsigned long ksp; /* kernel stack pointer */
  62. unsigned long usp; /* user stack pointer */
  63. unsigned short sr; /* saved status register */
  64. unsigned short fs; /* saved fs (sfc, dfc) */
  65. unsigned long crp[2]; /* cpu root pointer */
  66. unsigned long esp0; /* points to SR of stack frame */
  67. unsigned long faddr; /* info about last fault */
  68. int signo, code;
  69. unsigned long fp[8*3];
  70. unsigned long fpcntl[3]; /* fp control regs */
  71. unsigned char fpstate[FPSTATESIZE]; /* floating point state */
  72. struct task_work work;
  73. struct thread_info info;
  74. };
  75. #define INIT_THREAD { \
  76. ksp: sizeof(init_stack) + (unsigned long) init_stack, \
  77. sr: PS_S, \
  78. fs: __KERNEL_DS, \
  79. info: INIT_THREAD_INFO(init_task) \
  80. }
  81. /*
  82. * Do necessary setup to start up a newly executed thread.
  83. */
  84. static inline void start_thread(struct pt_regs * regs, unsigned long pc,
  85. unsigned long usp)
  86. {
  87. /* reads from user space */
  88. set_fs(USER_DS);
  89. regs->pc = pc;
  90. regs->sr &= ~0x2000;
  91. wrusp(usp);
  92. }
  93. /* Forward declaration, a strange C thing */
  94. struct task_struct;
  95. /* Free all resources held by a thread. */
  96. static inline void release_thread(struct task_struct *dead_task)
  97. {
  98. }
  99. /* Prepare to copy thread state - unlazy all lazy status */
  100. #define prepare_to_copy(tsk) do { } while (0)
  101. extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  102. /*
  103. * Free current thread data structures etc..
  104. */
  105. static inline void exit_thread(void)
  106. {
  107. }
  108. extern unsigned long thread_saved_pc(struct task_struct *tsk);
  109. unsigned long get_wchan(struct task_struct *p);
  110. #define KSTK_EIP(tsk) \
  111. ({ \
  112. unsigned long eip = 0; \
  113. if ((tsk)->thread.esp0 > PAGE_SIZE && \
  114. (virt_addr_valid((tsk)->thread.esp0))) \
  115. eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
  116. eip; })
  117. #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
  118. #define cpu_relax() barrier()
  119. #endif