processor.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. * Bus types
  33. */
  34. #define EISA_bus 0
  35. struct thread_struct {
  36. struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */
  37. struct task_struct *curr; /* [GR29] current pointer for this thread */
  38. unsigned long sp; /* [GR1 ] kernel stack pointer */
  39. unsigned long fp; /* [GR2 ] kernel frame pointer */
  40. unsigned long lr; /* link register */
  41. unsigned long pc; /* program counter */
  42. unsigned long gr[12]; /* [GR16-GR27] */
  43. unsigned long sched_lr; /* LR from schedule() */
  44. union {
  45. struct pt_regs *frame0; /* top (user) stack frame */
  46. struct user_context *user; /* userspace context */
  47. };
  48. } __attribute__((aligned(8)));
  49. extern struct pt_regs *__kernel_frame0_ptr;
  50. extern struct task_struct *__kernel_current_task;
  51. #endif
  52. #ifndef __ASSEMBLY__
  53. #define INIT_THREAD_FRAME0 \
  54. ((struct pt_regs *) \
  55. (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context)))
  56. #define INIT_THREAD { \
  57. NULL, \
  58. (struct task_struct *) init_stack, \
  59. 0, 0, 0, 0, \
  60. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \
  61. 0, \
  62. { INIT_THREAD_FRAME0 }, \
  63. }
  64. /*
  65. * do necessary setup to start up a newly executed thread.
  66. */
  67. #define start_thread(_regs, _pc, _usp) \
  68. do { \
  69. _regs->pc = (_pc); \
  70. _regs->psr &= ~PSR_S; \
  71. _regs->sp = (_usp); \
  72. } while(0)
  73. /* Free all resources held by a thread. */
  74. static inline void release_thread(struct task_struct *dead_task)
  75. {
  76. }
  77. extern asmlinkage void save_user_regs(struct user_context *target);
  78. extern asmlinkage void *restore_user_regs(const struct user_context *target, ...);
  79. #define copy_segments(tsk, mm) do { } while (0)
  80. #define release_segments(mm) do { } while (0)
  81. #define forget_segments() do { } while (0)
  82. /*
  83. * Return saved PC of a blocked thread.
  84. */
  85. extern unsigned long thread_saved_pc(struct task_struct *tsk);
  86. unsigned long get_wchan(struct task_struct *p);
  87. #define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc)
  88. #define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
  89. #define cpu_relax() barrier()
  90. #define cpu_relax_lowlatency() cpu_relax()
  91. /* data cache prefetch */
  92. #define ARCH_HAS_PREFETCH
  93. static inline void prefetch(const void *x)
  94. {
  95. asm volatile("dcpl %0,gr0,#0" : : "r"(x));
  96. }
  97. #endif /* __ASSEMBLY__ */
  98. #endif /* _ASM_PROCESSOR_H */