processor.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. * include/asm-v850/processor.h
  3. *
  4. * Copyright (C) 2001,02,03 NEC Electronics Corporation
  5. * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General
  8. * Public License. See the file COPYING in the main directory of this
  9. * archive for more details.
  10. *
  11. * Written by Miles Bader <miles@gnu.org>
  12. */
  13. #ifndef __V850_PROCESSOR_H__
  14. #define __V850_PROCESSOR_H__
  15. #ifndef __ASSEMBLY__ /* <linux/thread_info.h> is not asm-safe. */
  16. #include <linux/thread_info.h>
  17. #endif
  18. #include <linux/compiler.h>
  19. #include <asm/ptrace.h>
  20. #include <asm/entry.h>
  21. /* Some code expects `segment' stuff to be defined here. */
  22. #include <asm/segment.h>
  23. /*
  24. * The only places this is used seem to be horrible bletcherous kludges,
  25. * so we just define it to be as large as possible.
  26. */
  27. #define TASK_SIZE (0xFFFFFFFF)
  28. /*
  29. * This decides where the kernel will search for a free chunk of vm
  30. * space during mmap's. We won't be using it.
  31. */
  32. #define TASK_UNMAPPED_BASE 0
  33. #ifndef __ASSEMBLY__
  34. /*
  35. * Default implementation of macro that returns current
  36. * instruction pointer ("program counter").
  37. */
  38. #define current_text_addr() ({ __label__ _l; _l: &&_l;})
  39. /* If you change this, you must change the associated assembly-languages
  40. constants defined below, THREAD_*. */
  41. struct thread_struct {
  42. /* kernel stack pointer (must be first field in structure) */
  43. unsigned long ksp;
  44. };
  45. #define INIT_THREAD { sizeof init_stack + (unsigned long)init_stack }
  46. /* Do necessary setup to start up a newly executed thread. */
  47. static inline void start_thread (struct pt_regs *regs,
  48. unsigned long pc, unsigned long usp)
  49. {
  50. regs->pc = pc;
  51. regs->gpr[GPR_SP] = usp;
  52. regs->kernel_mode = 0;
  53. }
  54. /* Free all resources held by a thread. */
  55. static inline void release_thread (struct task_struct *dead_task)
  56. {
  57. }
  58. /* Prepare to copy thread state - unlazy all lazy status */
  59. #define prepare_to_copy(tsk) do { } while (0)
  60. extern int kernel_thread (int (*fn)(void *), void * arg, unsigned long flags);
  61. /* Free current thread data structures etc. */
  62. static inline void exit_thread (void)
  63. {
  64. }
  65. /* Return the registers saved during context-switch by the currently
  66. not-running thread T. Note that this only includes some registers!
  67. See entry.S for details. */
  68. #define thread_saved_regs(t) \
  69. ((struct pt_regs*)((t)->thread.ksp + STATE_SAVE_PT_OFFSET))
  70. /* Return saved (kernel) PC of a blocked thread. Actually, we return the
  71. LP register, because the thread is actually blocked in switch_thread,
  72. and we're interested in the PC it will _return_ to. */
  73. #define thread_saved_pc(t) (thread_saved_regs(t)->gpr[GPR_LP])
  74. unsigned long get_wchan (struct task_struct *p);
  75. /* Return some info about the user process TASK. */
  76. #define task_tos(task) ((unsigned long)task_stack_page(task) + THREAD_SIZE)
  77. #define task_pt_regs(task) ((struct pt_regs *)task_tos (task) - 1)
  78. #define task_sp(task) (task_pt_regs (task)->gpr[GPR_SP])
  79. #define task_pc(task) (task_pt_regs (task)->pc)
  80. /* Grotty old names for some. */
  81. #define KSTK_EIP(task) task_pc (task)
  82. #define KSTK_ESP(task) task_sp (task)
  83. #define cpu_relax() barrier()
  84. #else /* __ASSEMBLY__ */
  85. #define THREAD_KSP 0
  86. #endif /* !__ASSEMBLY__ */
  87. #endif /* __V850_PROCESSOR_H__ */