diff options
author | Michal Simek <monstr@monstr.eu> | 2009-03-27 09:25:47 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-03-27 09:25:47 -0400 |
commit | 4684dadec6ca3f310b0d9ff1860ca6b6f11ffd2d (patch) | |
tree | 8a3f631cae3ce3bf3073fb8c3fc331afbc6f61a8 /arch | |
parent | dd0105a6e9dfd64d73a0aa6f4422f5cb0c743a6c (diff) |
microblaze_v8: string.h thread_info.h
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Acked-by: John Linn <john.linn@xilinx.com>
Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: John Williams <john.williams@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/microblaze/include/asm/string.h | 24 | ||||
-rw-r--r-- | arch/microblaze/include/asm/thread_info.h | 159 |
2 files changed, 183 insertions, 0 deletions
diff --git a/arch/microblaze/include/asm/string.h b/arch/microblaze/include/asm/string.h new file mode 100644 index 000000000000..f7728c90fc18 --- /dev/null +++ b/arch/microblaze/include/asm/string.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_STRING_H | ||
10 | #define _ASM_MICROBLAZE_STRING_H | ||
11 | |||
12 | #ifndef __KERNEL__ | ||
13 | |||
14 | #define __HAVE_ARCH_MEMSET | ||
15 | #define __HAVE_ARCH_MEMCPY | ||
16 | #define __HAVE_ARCH_MEMMOVE | ||
17 | |||
18 | extern void *memset(void *, int, __kernel_size_t); | ||
19 | extern void *memcpy(void *, const void *, __kernel_size_t); | ||
20 | extern void *memmove(void *, const void *, __kernel_size_t); | ||
21 | |||
22 | #endif /* __KERNEL__ */ | ||
23 | |||
24 | #endif /* _ASM_MICROBLAZE_STRING_H */ | ||
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h new file mode 100644 index 000000000000..4c3943e3f403 --- /dev/null +++ b/arch/microblaze/include/asm/thread_info.h | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_THREAD_INFO_H | ||
10 | #define _ASM_MICROBLAZE_THREAD_INFO_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | /* we have 8k stack */ | ||
15 | #define THREAD_SHIFT 13 | ||
16 | #define THREAD_SIZE (1 << THREAD_SHIFT) | ||
17 | #define THREAD_SIZE_ORDER 1 | ||
18 | |||
19 | #ifndef __ASSEMBLY__ | ||
20 | # include <linux/types.h> | ||
21 | # include <asm/processor.h> | ||
22 | # include <asm/segment.h> | ||
23 | |||
24 | /* | ||
25 | * low level task data that entry.S needs immediate access to | ||
26 | * - this struct should fit entirely inside of one cache line | ||
27 | * - this struct shares the supervisor stack pages | ||
28 | * - if the contents of this structure are changed, the assembly constants | ||
29 | * must also be changed | ||
30 | */ | ||
31 | |||
32 | struct cpu_context { | ||
33 | __u32 r1; /* stack pointer */ | ||
34 | __u32 r2; | ||
35 | /* dedicated registers */ | ||
36 | __u32 r13; | ||
37 | __u32 r14; | ||
38 | __u32 r15; | ||
39 | __u32 r16; | ||
40 | __u32 r17; | ||
41 | __u32 r18; | ||
42 | /* non-volatile registers */ | ||
43 | __u32 r19; | ||
44 | __u32 r20; | ||
45 | __u32 r21; | ||
46 | __u32 r22; | ||
47 | __u32 r23; | ||
48 | __u32 r24; | ||
49 | __u32 r25; | ||
50 | __u32 r26; | ||
51 | __u32 r27; | ||
52 | __u32 r28; | ||
53 | __u32 r29; | ||
54 | __u32 r30; | ||
55 | /* r31 is used as current task pointer */ | ||
56 | /* special purpose registers */ | ||
57 | __u32 msr; | ||
58 | __u32 ear; | ||
59 | __u32 esr; | ||
60 | __u32 fsr; | ||
61 | }; | ||
62 | |||
63 | struct thread_info { | ||
64 | struct task_struct *task; /* main task structure */ | ||
65 | struct exec_domain *exec_domain; /* execution domain */ | ||
66 | unsigned long flags; /* low level flags */ | ||
67 | unsigned long status; /* thread-synchronous flags */ | ||
68 | __u32 cpu; /* current CPU */ | ||
69 | __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/ | ||
70 | mm_segment_t addr_limit; /* thread address space */ | ||
71 | struct restart_block restart_block; | ||
72 | |||
73 | struct cpu_context cpu_context; | ||
74 | }; | ||
75 | |||
76 | /* | ||
77 | * macros/functions for gaining access to the thread information structure | ||
78 | * | ||
79 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
80 | */ | ||
81 | #define INIT_THREAD_INFO(tsk) \ | ||
82 | { \ | ||
83 | .task = &tsk, \ | ||
84 | .exec_domain = &default_exec_domain, \ | ||
85 | .flags = 0, \ | ||
86 | .cpu = 0, \ | ||
87 | .preempt_count = 1, \ | ||
88 | .addr_limit = KERNEL_DS, \ | ||
89 | .restart_block = { \ | ||
90 | .fn = do_no_restart_syscall, \ | ||
91 | }, \ | ||
92 | } | ||
93 | |||
94 | #define init_thread_info (init_thread_union.thread_info) | ||
95 | #define init_stack (init_thread_union.stack) | ||
96 | |||
97 | /* how to get the thread information struct from C */ | ||
98 | static inline struct thread_info *current_thread_info(void) | ||
99 | { | ||
100 | register unsigned long sp asm("r1"); | ||
101 | |||
102 | return (struct thread_info *)(sp & ~(THREAD_SIZE-1)); | ||
103 | } | ||
104 | |||
105 | /* thread information allocation */ | ||
106 | #endif /* __ASSEMBLY__ */ | ||
107 | |||
108 | #define PREEMPT_ACTIVE 0x10000000 | ||
109 | |||
110 | /* | ||
111 | * thread information flags | ||
112 | * - these are process state flags that various assembly files may | ||
113 | * need to access | ||
114 | * - pending work-to-be-done flags are in LSW | ||
115 | * - other flags in MSW | ||
116 | */ | ||
117 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
118 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
119 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
120 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
121 | /* restore singlestep on return to user mode */ | ||
122 | #define TIF_SINGLESTEP 4 | ||
123 | #define TIF_IRET 5 /* return with iret */ | ||
124 | #define TIF_MEMDIE 6 | ||
125 | #define TIF_FREEZE 14 /* Freezing for suspend */ | ||
126 | |||
127 | /* FIXME change in entry.S */ | ||
128 | #define TIF_KERNEL_TRACE 8 /* kernel trace active */ | ||
129 | |||
130 | /* true if poll_idle() is polling TIF_NEED_RESCHED */ | ||
131 | #define TIF_POLLING_NRFLAG 16 | ||
132 | |||
133 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
134 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
135 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
136 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
137 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) | ||
138 | #define _TIF_IRET (1<<TIF_IRET) | ||
139 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
140 | #define _TIF_FREEZE (1<<TIF_FREEZE) | ||
141 | #define _TIF_KERNEL_TRACE (1 << TIF_KERNEL_TRACE) | ||
142 | |||
143 | /* work to do on interrupt/exception return */ | ||
144 | #define _TIF_WORK_MASK 0x0000FFFE | ||
145 | /* work to do on any return to u-space */ | ||
146 | #define _TIF_ALLWORK_MASK 0x0000FFFF | ||
147 | |||
148 | /* | ||
149 | * Thread-synchronous status. | ||
150 | * | ||
151 | * This is different from the flags in that nobody else | ||
152 | * ever touches our thread-synchronous status, so we don't | ||
153 | * have to worry about atomic accesses. | ||
154 | */ | ||
155 | /* FPU was used by this task this quantum (SMP) */ | ||
156 | #define TS_USEDFPU 0x0001 | ||
157 | |||
158 | #endif /* __KERNEL__ */ | ||
159 | #endif /* _ASM_MICROBLAZE_THREAD_INFO_H */ | ||