Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
processor.h
Go to the documentation of this file.
1 #ifndef _ASM_SCORE_PROCESSOR_H
2 #define _ASM_SCORE_PROCESSOR_H
3 
4 #include <linux/cpumask.h>
5 #include <linux/threads.h>
6 
7 #include <asm/segment.h>
8 
9 struct task_struct;
10 
11 /*
12  * System setup and hardware flags..
13  */
14 extern void (*cpu_wait)(void);
15 
16 extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
17 extern unsigned long thread_saved_pc(struct task_struct *tsk);
18 extern void start_thread(struct pt_regs *regs,
19  unsigned long pc, unsigned long sp);
20 extern unsigned long get_wchan(struct task_struct *p);
21 
22 /*
23  * Return current * instruction pointer ("program counter").
24  */
25 #define current_text_addr() ({ __label__ _l; _l: &&_l; })
26 
27 #define cpu_relax() barrier()
28 #define release_thread(thread) do {} while (0)
29 
30 /*
31  * User space process size: 2GB. This is hardcoded into a few places,
32  * so don't change it unless you know what you are doing.
33  */
34 #define TASK_SIZE 0x7fff8000UL
35 
36 /*
37  * This decides where the kernel will search for a free chunk of vm
38  * space during mmap's.
39  */
40 #define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
41 
42 #ifdef __KERNEL__
43 #define STACK_TOP TASK_SIZE
44 #define STACK_TOP_MAX TASK_SIZE
45 #endif
46 
47 /*
48  * If you change thread_struct remember to change the #defines below too!
49  */
50 struct thread_struct {
51  unsigned long reg0, reg2, reg3;
52  unsigned long reg12, reg13, reg14, reg15, reg16;
53  unsigned long reg17, reg18, reg19, reg20, reg21;
54 
55  unsigned long cp0_psr;
56  unsigned long cp0_ema; /* Last user fault */
57  unsigned long cp0_badvaddr; /* Last user fault */
58  unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
59  unsigned long error_code;
60  unsigned long trap_no;
61 
62  unsigned long mflags;
63  unsigned long reg29;
64 
65  unsigned long single_step;
66  unsigned long ss_nextcnt;
67 
68  unsigned long insn1_type;
69  unsigned long addr1;
70  unsigned long insn1;
71 
72  unsigned long insn2_type;
73  unsigned long addr2;
74  unsigned long insn2;
75 
77 };
78 
79 #define INIT_THREAD { \
80  .reg0 = 0, \
81  .reg2 = 0, \
82  .reg3 = 0, \
83  .reg12 = 0, \
84  .reg13 = 0, \
85  .reg14 = 0, \
86  .reg15 = 0, \
87  .reg16 = 0, \
88  .reg17 = 0, \
89  .reg18 = 0, \
90  .reg19 = 0, \
91  .reg20 = 0, \
92  .reg21 = 0, \
93  .cp0_psr = 0, \
94  .error_code = 0, \
95  .trap_no = 0, \
96 }
97 
98 #define kstk_tos(tsk) \
99  ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
100 #define task_pt_regs(tsk) ((struct pt_regs *)kstk_tos(tsk) - 1)
101 
102 #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
103 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
104 
105 #endif /* _ASM_SCORE_PROCESSOR_H */