Loading...
1/* thread_info.h: description
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * Derived from include/asm-i386/thread_info.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef _ASM_THREAD_INFO_H
14#define _ASM_THREAD_INFO_H
15
16#ifdef __KERNEL__
17
18#ifndef __ASSEMBLY__
19#include <asm/processor.h>
20#endif
21
22#define THREAD_SIZE 8192
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 must also be changed
29 */
30#ifndef __ASSEMBLY__
31
32struct thread_info {
33 struct task_struct *task; /* main task structure */
34 unsigned long flags; /* low level flags */
35 unsigned long status; /* thread-synchronous flags */
36 __u32 cpu; /* current CPU */
37 int preempt_count; /* 0 => preemptable, <0 => BUG */
38
39 mm_segment_t addr_limit; /* thread address space:
40 * 0-0xBFFFFFFF for user-thead
41 * 0-0xFFFFFFFF for kernel-thread
42 */
43
44 __u8 supervisor_stack[0];
45};
46
47#else /* !__ASSEMBLY__ */
48
49#include <asm/asm-offsets.h>
50
51#endif
52
53/*
54 * macros/functions for gaining access to the thread information structure
55 */
56#ifndef __ASSEMBLY__
57
58#define INIT_THREAD_INFO(tsk) \
59{ \
60 .task = &tsk, \
61 .flags = 0, \
62 .cpu = 0, \
63 .preempt_count = INIT_PREEMPT_COUNT, \
64 .addr_limit = KERNEL_DS, \
65}
66
67#define init_thread_info (init_thread_union.thread_info)
68#define init_stack (init_thread_union.stack)
69
70/* how to get the thread information struct from C */
71register struct thread_info *__current_thread_info asm("gr15");
72
73#define current_thread_info() ({ __current_thread_info; })
74
75#endif /* __ASSEMBLY__ */
76
77/*
78 * thread information flags
79 * - these are process state flags that various assembly files may need to access
80 * - pending work-to-be-done flags are in LSW
81 * - other flags in MSW
82 */
83#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
84#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
85#define TIF_SIGPENDING 2 /* signal pending */
86#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
87#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
88#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
89#define TIF_MEMDIE 7 /* is terminating due to OOM killer */
90
91#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
92#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
93#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
94#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
95#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
96
97/* work to do on interrupt/exception return */
98#define _TIF_WORK_MASK \
99 (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP)
100
101/* work to do on any return to u-space */
102#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
103
104#if _TIF_ALLWORK_MASK >= 0x2000
105#error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)"
106#endif
107
108/*
109 * Thread-synchronous status.
110 *
111 * This is different from the flags in that nobody else
112 * ever touches our thread-synchronous status, so we don't
113 * have to worry about atomic accesses.
114 */
115#define TS_USEDFPM 0x0001 /* FPU/Media was used by this task this quantum (SMP) */
116
117#endif /* __KERNEL__ */
118
119#endif /* _ASM_THREAD_INFO_H */
1/* thread_info.h: description
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * Derived from include/asm-i386/thread_info.h
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifndef _ASM_THREAD_INFO_H
14#define _ASM_THREAD_INFO_H
15
16#ifdef __KERNEL__
17
18#ifndef __ASSEMBLY__
19#include <asm/processor.h>
20#endif
21
22#define THREAD_SIZE 8192
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 must also be changed
29 */
30#ifndef __ASSEMBLY__
31
32struct thread_info {
33 struct task_struct *task; /* main task structure */
34 struct exec_domain *exec_domain; /* execution domain */
35 unsigned long flags; /* low level flags */
36 unsigned long status; /* thread-synchronous flags */
37 __u32 cpu; /* current CPU */
38 int preempt_count; /* 0 => preemptable, <0 => BUG */
39
40 mm_segment_t addr_limit; /* thread address space:
41 * 0-0xBFFFFFFF for user-thead
42 * 0-0xFFFFFFFF for kernel-thread
43 */
44 struct restart_block restart_block;
45
46 __u8 supervisor_stack[0];
47};
48
49#else /* !__ASSEMBLY__ */
50
51#include <asm/asm-offsets.h>
52
53#endif
54
55#define PREEMPT_ACTIVE 0x10000000
56
57/*
58 * macros/functions for gaining access to the thread information structure
59 */
60#ifndef __ASSEMBLY__
61
62#define INIT_THREAD_INFO(tsk) \
63{ \
64 .task = &tsk, \
65 .exec_domain = &default_exec_domain, \
66 .flags = 0, \
67 .cpu = 0, \
68 .preempt_count = INIT_PREEMPT_COUNT, \
69 .addr_limit = KERNEL_DS, \
70 .restart_block = { \
71 .fn = do_no_restart_syscall, \
72 }, \
73}
74
75#define init_thread_info (init_thread_union.thread_info)
76#define init_stack (init_thread_union.stack)
77
78/* how to get the thread information struct from C */
79register struct thread_info *__current_thread_info asm("gr15");
80
81#define current_thread_info() ({ __current_thread_info; })
82
83#endif /* __ASSEMBLY__ */
84
85/*
86 * thread information flags
87 * - these are process state flags that various assembly files may need to access
88 * - pending work-to-be-done flags are in LSW
89 * - other flags in MSW
90 */
91#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
92#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
93#define TIF_SIGPENDING 2 /* signal pending */
94#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
95#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
96#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
97#define TIF_POLLING_NRFLAG 6 /* true if poll_idle() is polling TIF_NEED_RESCHED */
98#define TIF_MEMDIE 7 /* is terminating due to OOM killer */
99
100#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
101#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
102#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
103#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
104#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
105#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
106#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
107
108/* work to do on interrupt/exception return */
109#define _TIF_WORK_MASK \
110 (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP)
111
112/* work to do on any return to u-space */
113#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
114
115#if _TIF_ALLWORK_MASK >= 0x2000
116#error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)"
117#endif
118
119/*
120 * Thread-synchronous status.
121 *
122 * This is different from the flags in that nobody else
123 * ever touches our thread-synchronous status, so we don't
124 * have to worry about atomic accesses.
125 */
126#define TS_USEDFPM 0x0001 /* FPU/Media was used by this task this quantum (SMP) */
127
128#endif /* __KERNEL__ */
129
130#endif /* _ASM_THREAD_INFO_H */