processor.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /*
  2. * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
  3. * Copyright (C) 2008-2009 PetaLogix
  4. * Copyright (C) 2006 Atmark Techno, Inc.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #ifndef _ASM_MICROBLAZE_PROCESSOR_H
  11. #define _ASM_MICROBLAZE_PROCESSOR_H
  12. #include <asm/ptrace.h>
  13. #include <asm/setup.h>
  14. #include <asm/registers.h>
  15. #include <asm/entry.h>
  16. #include <asm/current.h>
  17. # ifndef __ASSEMBLY__
  18. /* from kernel/cpu/mb.c */
  19. extern const struct seq_operations cpuinfo_op;
  20. # define cpu_relax() barrier()
  21. # define cpu_sleep() do {} while (0)
  22. # define prepare_to_copy(tsk) do {} while (0)
  23. #define task_pt_regs(tsk) \
  24. (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
  25. /* Do necessary setup to start up a newly executed thread. */
  26. void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
  27. extern void ret_from_fork(void);
  28. # endif /* __ASSEMBLY__ */
  29. # ifndef CONFIG_MMU
  30. /*
  31. * User space process size: memory size
  32. *
  33. * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both
  34. * user processes and the kernel is on the same memory region. They
  35. * both share the memory space and that is limited by the amount of
  36. * physical memory. thus, we set TASK_SIZE == amount of total memory.
  37. */
  38. # define TASK_SIZE (0x81000000 - 0x80000000)
  39. /*
  40. * Default implementation of macro that returns current
  41. * instruction pointer ("program counter").
  42. */
  43. # define current_text_addr() ({ __label__ _l; _l: &&_l; })
  44. /*
  45. * This decides where the kernel will search for a free chunk of vm
  46. * space during mmap's. We won't be using it
  47. */
  48. # define TASK_UNMAPPED_BASE 0
  49. /* definition in include/linux/sched.h */
  50. struct task_struct;
  51. /* thread_struct is gone. use thread_info instead. */
  52. struct thread_struct { };
  53. # define INIT_THREAD { }
  54. /* Free all resources held by a thread. */
  55. static inline void release_thread(struct task_struct *dead_task)
  56. {
  57. }
  58. /* Free all resources held by a thread. */
  59. static inline void exit_thread(void)
  60. {
  61. }
  62. extern unsigned long thread_saved_pc(struct task_struct *t);
  63. extern unsigned long get_wchan(struct task_struct *p);
  64. /*
  65. * create a kernel thread without removing it from tasklists
  66. */
  67. extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  68. # define KSTK_EIP(tsk) (0)
  69. # define KSTK_ESP(tsk) (0)
  70. # else /* CONFIG_MMU */
  71. /*
  72. * This is used to define STACK_TOP, and with MMU it must be below
  73. * kernel base to select the correct PGD when handling MMU exceptions.
  74. */
  75. # define TASK_SIZE (CONFIG_KERNEL_START)
  76. /*
  77. * This decides where the kernel will search for a free chunk of vm
  78. * space during mmap's.
  79. */
  80. # define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
  81. # define THREAD_KSP 0
  82. # ifndef __ASSEMBLY__
  83. /*
  84. * Default implementation of macro that returns current
  85. * instruction pointer ("program counter").
  86. */
  87. # define current_text_addr() ({ __label__ _l; _l: &&_l; })
  88. /* If you change this, you must change the associated assembly-languages
  89. * constants defined below, THREAD_*.
  90. */
  91. struct thread_struct {
  92. /* kernel stack pointer (must be first field in structure) */
  93. unsigned long ksp;
  94. unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
  95. void *pgdir; /* root of page-table tree */
  96. struct pt_regs *regs; /* Pointer to saved register state */
  97. };
  98. # define INIT_THREAD { \
  99. .ksp = sizeof init_stack + (unsigned long)init_stack, \
  100. .pgdir = swapper_pg_dir, \
  101. }
  102. /* Free all resources held by a thread. */
  103. extern inline void release_thread(struct task_struct *dead_task)
  104. {
  105. }
  106. extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  107. /* Free current thread data structures etc. */
  108. static inline void exit_thread(void)
  109. {
  110. }
  111. /* Return saved (kernel) PC of a blocked thread. */
  112. # define thread_saved_pc(tsk) \
  113. ((tsk)->thread.regs ? (tsk)->thread.regs->r15 : 0)
  114. unsigned long get_wchan(struct task_struct *p);
  115. /* The size allocated for kernel stacks. This _must_ be a power of two! */
  116. # define KERNEL_STACK_SIZE 0x2000
  117. /* Return some info about the user process TASK. */
  118. # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE)
  119. # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
  120. # define task_pt_regs_plus_args(tsk) \
  121. ((void *)task_pt_regs(tsk))
  122. # define task_sp(task) (task_regs(task)->r1)
  123. # define task_pc(task) (task_regs(task)->pc)
  124. /* Grotty old names for some. */
  125. # define KSTK_EIP(task) (task_pc(task))
  126. # define KSTK_ESP(task) (task_sp(task))
  127. /* FIXME */
  128. # define deactivate_mm(tsk, mm) do { } while (0)
  129. # define STACK_TOP TASK_SIZE
  130. # define STACK_TOP_MAX STACK_TOP
  131. void disable_hlt(void);
  132. void enable_hlt(void);
  133. void default_idle(void);
  134. #ifdef CONFIG_DEBUG_FS
  135. extern struct dentry *of_debugfs_root;
  136. #endif
  137. # endif /* __ASSEMBLY__ */
  138. # endif /* CONFIG_MMU */
  139. #endif /* _ASM_MICROBLAZE_PROCESSOR_H */