blob: e3b5284a6f91c0be27f766d4aaf0fe2671c8d2f1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* thread_info.h: PPC low-level thread information
2 * adapted from the i386 version by Paul Mackerras
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#ifdef __KERNEL__
12#ifndef __ASSEMBLY__
13/*
14 * low level task data.
15 * If you change this, change the TI_* offsets below to match.
16 */
17struct thread_info {
18 struct task_struct *task; /* main task structure */
19 struct exec_domain *exec_domain; /* execution domain */
20 unsigned long flags; /* low level flags */
21 unsigned long local_flags; /* non-racy flags */
22 int cpu; /* cpu we're on */
23 int preempt_count;
24 struct restart_block restart_block;
25};
26
27#define INIT_THREAD_INFO(tsk) \
28{ \
29 .task = &tsk, \
30 .exec_domain = &default_exec_domain, \
31 .flags = 0, \
32 .local_flags = 0, \
33 .cpu = 0, \
34 .preempt_count = 1, \
35 .restart_block = { \
36 .fn = do_no_restart_syscall, \
37 }, \
38}
39
40#define init_thread_info (init_thread_union.thread_info)
41#define init_stack (init_thread_union.stack)
42
43/*
44 * macros/functions for gaining access to the thread information structure
45 */
46
47/* how to get the thread information struct from C */
48static inline struct thread_info *current_thread_info(void)
49{
50 struct thread_info *ti;
51 __asm__("rlwinm %0,1,0,0,18" : "=r"(ti));
52 return ti;
53}
54
55/* thread information allocation */
56#define alloc_thread_info(tsk) ((struct thread_info *) \
57 __get_free_pages(GFP_KERNEL, 1))
58#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
59#define get_thread_info(ti) get_task_struct((ti)->task)
60#define put_thread_info(ti) put_task_struct((ti)->task)
61#endif /* __ASSEMBLY__ */
62
63/*
64 * Size of kernel stack for each process.
65 */
66#define THREAD_SIZE 8192 /* 2 pages */
67
68#define PREEMPT_ACTIVE 0x10000000
69
70/*
71 * thread information flag bit numbers
72 */
73#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
74#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
75#define TIF_SIGPENDING 2 /* signal pending */
76#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
77#define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
78 TIF_NEED_RESCHED */
79#define TIF_MEMDIE 5
David Woodhouseea9c1022005-05-08 15:56:09 +010080#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
81#define TIF_SECCOMP 7 /* secure computing */
82
Linus Torvalds1da177e2005-04-16 15:20:36 -070083/* as above, but as bit values */
84#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
85#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
86#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
87#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
88#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
David Woodhouseea9c1022005-05-08 15:56:09 +010089#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
90#define _TIF_SECCOMP (1<<TIF_SECCOMP)
91
92#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
Linus Torvalds1da177e2005-04-16 15:20:36 -070093
94/*
95 * Non racy (local) flags bit numbers
96 */
97#define TIFL_FORCE_NOERROR 0 /* don't return error from current
98 syscall even if result < 0 */
99
100/* as above, but as bit values */
101#define _TIFL_FORCE_NOERROR (1<<TIFL_FORCE_NOERROR)
102
103
104#endif /* __KERNEL__ */
105
106#endif /* _ASM_THREAD_INFO_H */