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