processor.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* processor.h: FRV processor definitions
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_PROCESSOR_H
  12. #define _ASM_PROCESSOR_H
  13. #include <asm/mem-layout.h>
  14. #ifndef __ASSEMBLY__
  15. /*
  16. * Default implementation of macro that returns current
  17. * instruction pointer ("program counter").
  18. */
  19. #define current_text_addr() ({ __label__ _l; _l: &&_l;})
  20. #include <linux/compiler.h>
  21. #include <linux/linkage.h>
  22. #include <asm/sections.h>
  23. #include <asm/segment.h>
  24. #include <asm/fpu.h>
  25. #include <asm/registers.h>
  26. #include <asm/ptrace.h>
  27. #include <asm/current.h>
  28. #include <asm/cache.h>
  29. /* Forward declaration, a strange C thing */
  30. struct task_struct;
  31. /*
  32. * CPU type and hardware bug flags. Kept separately for each CPU.
  33. */
  34. struct cpuinfo_frv {
  35. #ifdef CONFIG_MMU
  36. unsigned long *pgd_quick;
  37. unsigned long *pte_quick;
  38. unsigned long pgtable_cache_sz;
  39. #endif
  40. } __cacheline_aligned;
  41. extern struct cpuinfo_frv __nongprelbss boot_cpu_data;
  42. #define cpu_data (&boot_cpu_data)
  43. #define current_cpu_data boot_cpu_data
  44. /*
  45. * Bus types
  46. */
  47. #define EISA_bus 0
  48. #define MCA_bus 0
  49. struct thread_struct {
  50. struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */
  51. struct task_struct *curr; /* [GR29] current pointer for this thread */
  52. unsigned long sp; /* [GR1 ] kernel stack pointer */
  53. unsigned long fp; /* [GR2 ] kernel frame pointer */
  54. unsigned long lr; /* link register */
  55. unsigned long pc; /* program counter */
  56. unsigned long gr[12]; /* [GR16-GR27] */
  57. unsigned long sched_lr; /* LR from schedule() */
  58. union {
  59. struct pt_regs *frame0; /* top (user) stack frame */
  60. struct user_context *user; /* userspace context */
  61. };
  62. } __attribute__((aligned(8)));
  63. extern struct pt_regs *__kernel_frame0_ptr;
  64. extern struct task_struct *__kernel_current_task;
  65. #endif
  66. #ifndef __ASSEMBLY__
  67. #define INIT_THREAD_FRAME0 \
  68. ((struct pt_regs *) \
  69. (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context)))
  70. #define INIT_THREAD { \
  71. NULL, \
  72. (struct task_struct *) init_stack, \
  73. 0, 0, 0, 0, \
  74. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
  75. 0, \
  76. { INIT_THREAD_FRAME0 }, \
  77. }
  78. /*
  79. * do necessary setup to start up a newly executed thread.
  80. * - need to discard the frame stacked by init() invoking the execve syscall
  81. */
  82. #define start_thread(_regs, _pc, _usp) \
  83. do { \
  84. set_fs(USER_DS); /* reads from user space */ \
  85. __frame = __kernel_frame0_ptr; \
  86. __frame->pc = (_pc); \
  87. __frame->psr &= ~PSR_S; \
  88. __frame->sp = (_usp); \
  89. } while(0)
  90. extern void prepare_to_copy(struct task_struct *tsk);
  91. /* Free all resources held by a thread. */
  92. static inline void release_thread(struct task_struct *dead_task)
  93. {
  94. }
  95. extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  96. extern asmlinkage void save_user_regs(struct user_context *target);
  97. extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);
  98. #define copy_segments(tsk, mm) do { } while (0)
  99. #define release_segments(mm) do { } while (0)
  100. #define forget_segments() do { } while (0)
  101. /*
  102. * Free current thread data structures etc..
  103. */
  104. static inline void exit_thread(void)
  105. {
  106. }
  107. /*
  108. * Return saved PC of a blocked thread.
  109. */
  110. extern unsigned long thread_saved_pc(struct task_struct *tsk);
  111. unsigned long get_wchan(struct task_struct *p);
  112. #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc)
  113. #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
  114. /* Allocation and freeing of basic task resources. */
  115. extern struct task_struct *alloc_task_struct_node(int node);
  116. extern void free_task_struct(struct task_struct *p);
  117. #define cpu_relax() barrier()
  118. /* data cache prefetch */
  119. #define ARCH_HAS_PREFETCH
  120. static inline void prefetch(const void *x)
  121. {
  122. asm volatile("dcpl %0,gr0,#0" : : "r"(x));
  123. }
  124. #endif /* __ASSEMBLY__ */
  125. #endif /* _ASM_PROCESSOR_H */