File: /usr/src/linux/include/asm-arm/processor.h

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