aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-h8300/thread_info.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-h8300/thread_info.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/asm-h8300/thread_info.h')
-rw-r--r--include/asm-h8300/thread_info.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h
new file mode 100644
index 000000000000..b07c9344776f
--- /dev/null
+++ b/include/asm-h8300/thread_info.h
@@ -0,0 +1,109 @@
1/* thread_info.h: h8300 low-level thread information
2 * adapted from the i386 and PPC versions by Yoshinori Sato <ysato@users.sourceforge.jp>
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 */
7
8#ifndef _ASM_THREAD_INFO_H
9#define _ASM_THREAD_INFO_H
10
11#include <asm/page.h>
12
13#ifdef __KERNEL__
14
15#ifndef __ASSEMBLY__
16
17/*
18 * low level task data.
19 * If you change this, change the TI_* offsets below to match.
20 */
21struct thread_info {
22 struct task_struct *task; /* main task structure */
23 struct exec_domain *exec_domain; /* execution domain */
24 unsigned long flags; /* low level flags */
25 int cpu; /* cpu we're on */
26 int preempt_count; /* 0 => preemptable, <0 => BUG*/
27 struct restart_block restart_block;
28};
29
30/*
31 * macros/functions for gaining access to the thread information structure
32 */
33#define INIT_THREAD_INFO(tsk) \
34{ \
35 .task = &tsk, \
36 .exec_domain = &default_exec_domain, \
37 .flags = 0, \
38 .cpu = 0, \
39 .preempt_count = 1, \
40 .restart_block = { \
41 .fn = do_no_restart_syscall, \
42 }, \
43}
44
45#define init_thread_info (init_thread_union.thread_info)
46#define init_stack (init_thread_union.stack)
47
48
49/*
50 * Size of kernel stack for each process. This must be a power of 2...
51 */
52#define THREAD_SIZE 8192 /* 2 pages */
53
54
55/* how to get the thread information struct from C */
56static inline struct thread_info *current_thread_info(void)
57{
58 struct thread_info *ti;
59 __asm__(
60 "mov.l sp, %0 \n\t"
61 "and.l %1, %0"
62 : "=&r"(ti)
63 : "i" (~(THREAD_SIZE-1))
64 );
65 return ti;
66}
67
68/* thread information allocation */
69#define alloc_thread_info(tsk) ((struct thread_info *) \
70 __get_free_pages(GFP_KERNEL, 1))
71#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
72#define get_thread_info(ti) get_task_struct((ti)->task)
73#define put_thread_info(ti) put_task_struct((ti)->task)
74#endif /* __ASSEMBLY__ */
75
76/*
77 * Offsets in thread_info structure, used in assembly code
78 */
79#define TI_TASK 0
80#define TI_EXECDOMAIN 4
81#define TI_FLAGS 8
82#define TI_CPU 12
83#define TI_PRE_COUNT 16
84
85#define PREEMPT_ACTIVE 0x4000000
86
87/*
88 * thread information flag bit numbers
89 */
90#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
91#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
92#define TIF_SIGPENDING 2 /* signal pending */
93#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
94#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
95 TIF_NEED_RESCHED */
96#define TIF_MEMDIE 5
97
98/* as above, but as bit values */
99#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
100#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
101#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
102#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
103#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
104
105#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
106
107#endif /* __KERNEL__ */
108
109#endif /* _ASM_THREAD_INFO_H */