processor.h 3.4 KB

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