processor_no.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. * include/asm-m68knommu/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/compiler.h>
  14. #include <linux/threads.h>
  15. #include <asm/types.h>
  16. #include <asm/segment.h>
  17. #include <asm/fpu.h>
  18. #include <asm/ptrace.h>
  19. #include <asm/current.h>
  20. static inline unsigned long rdusp(void)
  21. {
  22. #ifdef CONFIG_COLDFIRE
  23. extern unsigned int sw_usp;
  24. return(sw_usp);
  25. #else
  26. unsigned long usp;
  27. __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
  28. return usp;
  29. #endif
  30. }
  31. static inline void wrusp(unsigned long usp)
  32. {
  33. #ifdef CONFIG_COLDFIRE
  34. extern unsigned int sw_usp;
  35. sw_usp = usp;
  36. #else
  37. __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
  38. #endif
  39. }
  40. /*
  41. * User space process size: 3.75GB. This is hardcoded into a few places,
  42. * so don't change it unless you know what you are doing.
  43. */
  44. #define TASK_SIZE (0xF0000000UL)
  45. /*
  46. * This decides where the kernel will search for a free chunk of vm
  47. * space during mmap's. We won't be using it
  48. */
  49. #define TASK_UNMAPPED_BASE 0
  50. /*
  51. * if you change this structure, you must change the code and offsets
  52. * in m68k/machasm.S
  53. */
  54. struct thread_struct {
  55. unsigned long ksp; /* kernel stack pointer */
  56. unsigned long usp; /* user stack pointer */
  57. unsigned short sr; /* saved status register */
  58. unsigned short fs; /* saved fs (sfc, dfc) */
  59. unsigned long crp[2]; /* cpu root pointer */
  60. unsigned long esp0; /* points to SR of stack frame */
  61. unsigned long fp[8*3];
  62. unsigned long fpcntl[3]; /* fp control regs */
  63. unsigned char fpstate[FPSTATESIZE]; /* floating point state */
  64. };
  65. #define INIT_THREAD { \
  66. sizeof(init_stack) + (unsigned long) init_stack, 0, \
  67. PS_S, __KERNEL_DS, \
  68. {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
  69. }
  70. /*
  71. * Coldfire stacks need to be re-aligned on trap exit, conventional
  72. * 68k can handle this case cleanly.
  73. */
  74. #if defined(CONFIG_COLDFIRE)
  75. #define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
  76. #else
  77. #define reformat(_regs) do { } while (0)
  78. #endif
  79. /*
  80. * Do necessary setup to start up a newly executed thread.
  81. *
  82. * pass the data segment into user programs if it exists,
  83. * it can't hurt anything as far as I can tell
  84. */
  85. #define start_thread(_regs, _pc, _usp) \
  86. do { \
  87. set_fs(USER_DS); /* reads from user space */ \
  88. (_regs)->pc = (_pc); \
  89. ((struct switch_stack *)(_regs))[-1].a6 = 0; \
  90. reformat(_regs); \
  91. if (current->mm) \
  92. (_regs)->d5 = current->mm->start_data; \
  93. (_regs)->sr &= ~0x2000; \
  94. wrusp(_usp); \
  95. } while(0)
  96. /* Forward declaration, a strange C thing */
  97. struct task_struct;
  98. /* Free all resources held by a thread. */
  99. static inline void release_thread(struct task_struct *dead_task)
  100. {
  101. }
  102. /* Prepare to copy thread state - unlazy all lazy status */
  103. #define prepare_to_copy(tsk) do { } while (0)
  104. extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  105. /*
  106. * Free current thread data structures etc..
  107. */
  108. static inline void exit_thread(void)
  109. {
  110. }
  111. unsigned long thread_saved_pc(struct task_struct *tsk);
  112. unsigned long get_wchan(struct task_struct *p);
  113. #define KSTK_EIP(tsk) \
  114. ({ \
  115. unsigned long eip = 0; \
  116. if ((tsk)->thread.esp0 > PAGE_SIZE && \
  117. (virt_addr_valid((tsk)->thread.esp0))) \
  118. eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \
  119. eip; })
  120. #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp)
  121. #define cpu_relax() barrier()
  122. #endif