Commit | Line | Data |
---|---|---|
f73670e8 G |
1 | /* |
2 | * linux/arch/unicore32/include/asm/thread_info.h | |
3 | * | |
4 | * Code specific to PKUnity SoC and UniCore ISA | |
5 | * | |
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | */ | |
12 | #ifndef __UNICORE_THREAD_INFO_H__ | |
13 | #define __UNICORE_THREAD_INFO_H__ | |
14 | ||
15 | #ifdef __KERNEL__ | |
16 | ||
17 | #include <linux/compiler.h> | |
18 | #include <asm/fpstate.h> | |
19 | ||
20 | #define THREAD_SIZE_ORDER 1 | |
21 | #define THREAD_SIZE 8192 | |
22 | #define THREAD_START_SP (THREAD_SIZE - 8) | |
23 | ||
24 | #ifndef __ASSEMBLY__ | |
25 | ||
26 | struct task_struct; | |
27 | struct exec_domain; | |
28 | ||
29 | #include <asm/types.h> | |
30 | ||
31 | typedef struct { | |
32 | unsigned long seg; | |
33 | } mm_segment_t; | |
34 | ||
35 | struct cpu_context_save { | |
36 | __u32 r4; | |
37 | __u32 r5; | |
38 | __u32 r6; | |
39 | __u32 r7; | |
40 | __u32 r8; | |
41 | __u32 r9; | |
42 | __u32 r10; | |
43 | __u32 r11; | |
44 | __u32 r12; | |
45 | __u32 r13; | |
46 | __u32 r14; | |
47 | __u32 r15; | |
48 | __u32 r16; | |
49 | __u32 r17; | |
50 | __u32 r18; | |
51 | __u32 r19; | |
52 | __u32 r20; | |
53 | __u32 r21; | |
54 | __u32 r22; | |
55 | __u32 r23; | |
56 | __u32 r24; | |
57 | __u32 r25; | |
58 | __u32 r26; | |
59 | __u32 fp; | |
60 | __u32 sp; | |
61 | __u32 pc; | |
62 | }; | |
63 | ||
64 | /* | |
65 | * low level task data that entry.S needs immediate access to. | |
66 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. | |
67 | */ | |
68 | struct thread_info { | |
69 | unsigned long flags; /* low level flags */ | |
70 | int preempt_count; /* 0 => preemptable */ | |
71 | /* <0 => bug */ | |
72 | mm_segment_t addr_limit; /* address limit */ | |
73 | struct task_struct *task; /* main task structure */ | |
74 | struct exec_domain *exec_domain; /* execution domain */ | |
75 | __u32 cpu; /* cpu */ | |
76 | struct cpu_context_save cpu_context; /* cpu context */ | |
77 | __u32 syscall; /* syscall number */ | |
78 | __u8 used_cp[16]; /* thread used copro */ | |
79 | #ifdef CONFIG_UNICORE_FPU_F64 | |
80 | struct fp_state fpstate __attribute__((aligned(8))); | |
81 | #endif | |
f73670e8 G |
82 | }; |
83 | ||
84 | #define INIT_THREAD_INFO(tsk) \ | |
85 | { \ | |
86 | .task = &tsk, \ | |
87 | .exec_domain = &default_exec_domain, \ | |
88 | .flags = 0, \ | |
89 | .preempt_count = INIT_PREEMPT_COUNT, \ | |
90 | .addr_limit = KERNEL_DS, \ | |
f73670e8 G |
91 | } |
92 | ||
93 | #define init_thread_info (init_thread_union.thread_info) | |
94 | #define init_stack (init_thread_union.stack) | |
95 | ||
96 | /* | |
97 | * how to get the thread information struct from C | |
98 | */ | |
99 | static inline struct thread_info *current_thread_info(void) __attribute_const__; | |
100 | ||
101 | static inline struct thread_info *current_thread_info(void) | |
102 | { | |
103 | register unsigned long sp asm ("sp"); | |
104 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); | |
105 | } | |
106 | ||
107 | #define thread_saved_pc(tsk) \ | |
108 | ((unsigned long)(task_thread_info(tsk)->cpu_context.pc)) | |
109 | #define thread_saved_sp(tsk) \ | |
110 | ((unsigned long)(task_thread_info(tsk)->cpu_context.sp)) | |
111 | #define thread_saved_fp(tsk) \ | |
112 | ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) | |
113 | ||
114 | #endif | |
115 | ||
f73670e8 G |
116 | /* |
117 | * thread information flags: | |
118 | * TIF_SYSCALL_TRACE - syscall trace active | |
119 | * TIF_SIGPENDING - signal pending | |
120 | * TIF_NEED_RESCHED - rescheduling necessary | |
121 | * TIF_NOTIFY_RESUME - callback before returning to user | |
122 | */ | |
123 | #define TIF_SIGPENDING 0 | |
124 | #define TIF_NEED_RESCHED 1 | |
125 | #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ | |
126 | #define TIF_SYSCALL_TRACE 8 | |
127 | #define TIF_MEMDIE 18 | |
f73670e8 G |
128 | #define TIF_RESTORE_SIGMASK 20 |
129 | ||
130 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | |
131 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | |
132 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | |
133 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | |
f73670e8 G |
134 | |
135 | /* | |
136 | * Change these and you break ASM code in entry-common.S | |
137 | */ | |
87b0e714 AV |
138 | #define _TIF_WORK_MASK \ |
139 | (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME) | |
f73670e8 G |
140 | |
141 | #endif /* __KERNEL__ */ | |
142 | #endif /* __UNICORE_THREAD_INFO_H__ */ |