processor.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. struct thread_struct {
  49. struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */
  50. struct task_struct *curr; /* [GR29] current pointer for this thread */
  51. unsigned long sp; /* [GR1 ] kernel stack pointer */
  52. unsigned long fp; /* [GR2 ] kernel frame pointer */
  53. unsigned long lr; /* link register */
  54. unsigned long pc; /* program counter */
  55. unsigned long gr[12]; /* [GR16-GR27] */
  56. unsigned long sched_lr; /* LR from schedule() */
  57. union {
  58. struct pt_regs *frame0; /* top (user) stack frame */
  59. struct user_context *user; /* userspace context */
  60. };
  61. } __attribute__((aligned(8)));
  62. extern struct pt_regs *__kernel_frame0_ptr;
  63. extern struct task_struct *__kernel_current_task;
  64. #endif
  65. #ifndef __ASSEMBLY__
  66. #define INIT_THREAD_FRAME0 \
  67. ((struct pt_regs *) \
  68. (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context)))
  69. #define INIT_THREAD { \
  70. NULL, \
  71. (struct task_struct *) init_stack, \
  72. 0, 0, 0, 0, \
  73. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
  74. 0, \
  75. { INIT_THREAD_FRAME0 }, \
  76. }
  77. /*
  78. * do necessary setup to start up a newly executed thread.
  79. * - need to discard the frame stacked by init() invoking the execve syscall
  80. */
  81. #define start_thread(_regs, _pc, _usp) \
  82. do { \
  83. __frame = __kernel_frame0_ptr; \
  84. __frame->pc = (_pc); \
  85. __frame->psr &= ~PSR_S; \
  86. __frame->sp = (_usp); \
  87. } while(0)
  88. extern void prepare_to_copy(struct task_struct *tsk);
  89. /* Free all resources held by a thread. */
  90. static inline void release_thread(struct task_struct *dead_task)
  91. {
  92. }
  93. extern asmlinkage int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
  94. extern asmlinkage void save_user_regs(struct user_context *target);
  95. extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);
  96. #define copy_segments(tsk, mm) do { } while (0)
  97. #define release_segments(mm) do { } while (0)
  98. #define forget_segments() do { } while (0)
  99. /*
  100. * Free current thread data structures etc..
  101. */
  102. static inline void exit_thread(void)
  103. {
  104. }
  105. /*
  106. * Return saved PC of a blocked thread.
  107. */
  108. extern unsigned long thread_saved_pc(struct task_struct *tsk);
  109. unsigned long get_wchan(struct task_struct *p);
  110. #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc)
  111. #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
  112. /* Allocation and freeing of basic task resources. */
  113. extern struct task_struct *alloc_task_struct_node(int node);
  114. extern void free_task_struct(struct task_struct *p);
  115. #define cpu_relax() barrier()
  116. /* data cache prefetch */
  117. #define ARCH_HAS_PREFETCH
  118. static inline void prefetch(const void *x)
  119. {
  120. asm volatile("dcpl %0,gr0,#0" : : "r"(x));
  121. }
  122. #endif /* __ASSEMBLY__ */
  123. #endif /* _ASM_PROCESSOR_H */