processor.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * linux/include/asm-arm/processor.h
  3. *
  4. * Copyright (C) 1995-2002 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_ARM_PROCESSOR_H
  11. #define __ASM_ARM_PROCESSOR_H
  12. /*
  13. * Default implementation of macro that returns current
  14. * instruction pointer ("program counter").
  15. */
  16. #define current_text_addr() ({ __label__ _l; _l: &&_l;})
  17. #define FP_SIZE 35
  18. struct fp_hard_struct {
  19. unsigned int save[FP_SIZE]; /* as yet undefined */
  20. };
  21. struct fp_soft_struct {
  22. unsigned int save[FP_SIZE]; /* undefined information */
  23. };
  24. union fp_state {
  25. struct fp_hard_struct hard;
  26. struct fp_soft_struct soft;
  27. };
  28. typedef unsigned long mm_segment_t; /* domain register */
  29. #ifdef __KERNEL__
  30. #define EISA_bus 0
  31. #define MCA_bus 0
  32. #define MCA_bus__is_a_macro
  33. #include <asm/atomic.h>
  34. #include <asm/ptrace.h>
  35. #if 0 /* XXX###XXX */
  36. #include <asm/arch/memory.h>
  37. #endif /* XXX###XXX */
  38. #include <asm/proc-armv/processor.h>
  39. #include <asm/types.h>
  40. union debug_insn {
  41. u32 arm;
  42. u16 thumb;
  43. };
  44. struct debug_entry {
  45. u32 address;
  46. union debug_insn insn;
  47. };
  48. struct debug_info {
  49. int nsaved;
  50. struct debug_entry bp[2];
  51. };
  52. struct thread_struct {
  53. atomic_t refcount;
  54. /* fault info */
  55. unsigned long address;
  56. unsigned long trap_no;
  57. unsigned long error_code;
  58. /* floating point */
  59. union fp_state fpstate;
  60. /* debugging */
  61. struct debug_info debug;
  62. /* context info */
  63. struct context_save_struct *save;
  64. EXTRA_THREAD_STRUCT
  65. };
  66. #define INIT_THREAD { \
  67. refcount: ATOMIC_INIT(1), \
  68. EXTRA_THREAD_STRUCT_INIT \
  69. }
  70. /*
  71. * Return saved PC of a blocked thread.
  72. */
  73. static inline unsigned long thread_saved_pc(struct thread_struct *t)
  74. {
  75. return t->save ? pc_pointer(t->save->pc) : 0;
  76. }
  77. static inline unsigned long thread_saved_fp(struct thread_struct *t)
  78. {
  79. return t->save ? t->save->fp : 0;
  80. }
  81. /* Forward declaration, a strange C thing */
  82. struct task_struct;
  83. /* Free all resources held by a thread. */
  84. extern void release_thread(struct task_struct *);
  85. /* Copy and release all segment info associated with a VM */
  86. #define copy_segments(tsk, mm) do { } while (0)
  87. #define release_segments(mm) do { } while (0)
  88. unsigned long get_wchan(struct task_struct *p);
  89. #define THREAD_SIZE (8192)
  90. extern struct task_struct *alloc_task_struct(void);
  91. extern void __free_task_struct(struct task_struct *);
  92. #define get_task_struct(p) atomic_inc(&(p)->thread.refcount)
  93. #define free_task_struct(p) \
  94. do { \
  95. if (atomic_dec_and_test(&(p)->thread.refcount)) \
  96. __free_task_struct((p)); \
  97. } while (0)
  98. #define init_task (init_task_union.task)
  99. #define init_stack (init_task_union.stack)
  100. #define cpu_relax() barrier()
  101. /*
  102. * Create a new kernel thread
  103. */
  104. extern int arch_kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
  105. #endif
  106. #endif /* __ASM_ARM_PROCESSOR_H */