/Ethereal-msm8939-beta9/arch/microblaze/include/asm/processor.h

https://bitbucket.org/MilosStamenkovic95/etherealos · C Header · 168 lines · 76 code · 38 blank · 54 comment · 2 complexity · a00b7060e4290724859f7af6b0254ccb MD5 · raw file

  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 task_pt_regs(tsk) \
  22. (((struct pt_regs *)(THREAD_SIZE + task_stack_page(tsk))) - 1)
  23. /* Do necessary setup to start up a newly executed thread. */
  24. void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long usp);
  25. extern void ret_from_fork(void);
  26. extern void ret_from_kernel_thread(void);
  27. # endif /* __ASSEMBLY__ */
  28. # ifndef CONFIG_MMU
  29. /*
  30. * User space process size: memory size
  31. *
  32. * TASK_SIZE on MMU cpu is usually 1GB. However, on no-MMU arch, both
  33. * user processes and the kernel is on the same memory region. They
  34. * both share the memory space and that is limited by the amount of
  35. * physical memory. thus, we set TASK_SIZE == amount of total memory.
  36. */
  37. # define TASK_SIZE (0x81000000 - 0x80000000)
  38. /*
  39. * Default implementation of macro that returns current
  40. * instruction pointer ("program counter").
  41. */
  42. # define current_text_addr() ({ __label__ _l; _l: &&_l; })
  43. /*
  44. * This decides where the kernel will search for a free chunk of vm
  45. * space during mmap's. We won't be using it
  46. */
  47. # define TASK_UNMAPPED_BASE 0
  48. /* definition in include/linux/sched.h */
  49. struct task_struct;
  50. /* thread_struct is gone. use thread_info instead. */
  51. struct thread_struct { };
  52. # define INIT_THREAD { }
  53. /* Free all resources held by a thread. */
  54. static inline void release_thread(struct task_struct *dead_task)
  55. {
  56. }
  57. /* Free all resources held by a thread. */
  58. static inline void exit_thread(void)
  59. {
  60. }
  61. extern unsigned long thread_saved_pc(struct task_struct *t);
  62. extern unsigned long get_wchan(struct task_struct *p);
  63. # define KSTK_EIP(tsk) (0)
  64. # define KSTK_ESP(tsk) (0)
  65. # else /* CONFIG_MMU */
  66. /*
  67. * This is used to define STACK_TOP, and with MMU it must be below
  68. * kernel base to select the correct PGD when handling MMU exceptions.
  69. */
  70. # define TASK_SIZE (CONFIG_KERNEL_START)
  71. /*
  72. * This decides where the kernel will search for a free chunk of vm
  73. * space during mmap's.
  74. */
  75. # define TASK_UNMAPPED_BASE (TASK_SIZE / 8 * 3)
  76. # define THREAD_KSP 0
  77. # ifndef __ASSEMBLY__
  78. /*
  79. * Default implementation of macro that returns current
  80. * instruction pointer ("program counter").
  81. */
  82. # define current_text_addr() ({ __label__ _l; _l: &&_l; })
  83. /* If you change this, you must change the associated assembly-languages
  84. * constants defined below, THREAD_*.
  85. */
  86. struct thread_struct {
  87. /* kernel stack pointer (must be first field in structure) */
  88. unsigned long ksp;
  89. unsigned long ksp_limit; /* if ksp <= ksp_limit stack overflow */
  90. void *pgdir; /* root of page-table tree */
  91. struct pt_regs *regs; /* Pointer to saved register state */
  92. };
  93. # define INIT_THREAD { \
  94. .ksp = sizeof init_stack + (unsigned long)init_stack, \
  95. .pgdir = swapper_pg_dir, \
  96. }
  97. /* Free all resources held by a thread. */
  98. extern inline void release_thread(struct task_struct *dead_task)
  99. {
  100. }
  101. /* Free current thread data structures etc. */
  102. static inline void exit_thread(void)
  103. {
  104. }
  105. /* Return saved (kernel) PC of a blocked thread. */
  106. # define thread_saved_pc(tsk) \
  107. ((tsk)->thread.regs ? (tsk)->thread.regs->r15 : 0)
  108. unsigned long get_wchan(struct task_struct *p);
  109. /* The size allocated for kernel stacks. This _must_ be a power of two! */
  110. # define KERNEL_STACK_SIZE 0x2000
  111. /* Return some info about the user process TASK. */
  112. # define task_tos(task) ((unsigned long)(task) + KERNEL_STACK_SIZE)
  113. # define task_regs(task) ((struct pt_regs *)task_tos(task) - 1)
  114. # define task_pt_regs_plus_args(tsk) \
  115. ((void *)task_pt_regs(tsk))
  116. # define task_sp(task) (task_regs(task)->r1)
  117. # define task_pc(task) (task_regs(task)->pc)
  118. /* Grotty old names for some. */
  119. # define KSTK_EIP(task) (task_pc(task))
  120. # define KSTK_ESP(task) (task_sp(task))
  121. /* FIXME */
  122. # define deactivate_mm(tsk, mm) do { } while (0)
  123. # define STACK_TOP TASK_SIZE
  124. # define STACK_TOP_MAX STACK_TOP
  125. #ifdef CONFIG_DEBUG_FS
  126. extern struct dentry *of_debugfs_root;
  127. #endif
  128. # endif /* __ASSEMBLY__ */
  129. # endif /* CONFIG_MMU */
  130. #endif /* _ASM_MICROBLAZE_PROCESSOR_H */