]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
f5e706ad SR |
2 | /* |
3 | * thread_info.h: sparc low-level thread information | |
4 | * adapted from the ppc version by Pete Zaitcev, which was | |
5 | * adapted from the i386 version by Paul Mackerras | |
6 | * | |
7 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | |
8 | * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com) | |
9 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | |
10 | */ | |
11 | ||
12 | #ifndef _ASM_THREAD_INFO_H | |
13 | #define _ASM_THREAD_INFO_H | |
14 | ||
15 | #ifdef __KERNEL__ | |
16 | ||
17 | #ifndef __ASSEMBLY__ | |
18 | ||
f5e706ad SR |
19 | #include <asm/ptrace.h> |
20 | #include <asm/page.h> | |
21 | ||
22 | /* | |
23 | * Low level task data. | |
24 | * | |
25 | * If you change this, change the TI_* offsets below to match. | |
26 | */ | |
27 | #define NSWINS 8 | |
28 | struct thread_info { | |
29 | unsigned long uwinmask; | |
30 | struct task_struct *task; /* main task structure */ | |
f5e706ad SR |
31 | unsigned long flags; /* low level flags */ |
32 | int cpu; /* cpu we're on */ | |
33 | int preempt_count; /* 0 => preemptable, | |
34 | <0 => BUG */ | |
35 | int softirq_count; | |
36 | int hardirq_count; | |
37 | ||
720d7071 GR |
38 | u32 __unused; |
39 | ||
f5e706ad SR |
40 | /* Context switch saved kernel state. */ |
41 | unsigned long ksp; /* ... ksp __attribute__ ((aligned (8))); */ | |
42 | unsigned long kpc; | |
43 | unsigned long kpsr; | |
44 | unsigned long kwim; | |
45 | ||
46 | /* A place to store user windows and stack pointers | |
47 | * when the stack needs inspection. | |
48 | */ | |
4d7b92ad | 49 | struct reg_window32 reg_window[NSWINS]; /* align for ldd! */ |
f5e706ad SR |
50 | unsigned long rwbuf_stkptrs[NSWINS]; |
51 | unsigned long w_saved; | |
f5e706ad SR |
52 | }; |
53 | ||
54 | /* | |
55 | * macros/functions for gaining access to the thread information structure | |
f5e706ad SR |
56 | */ |
57 | #define INIT_THREAD_INFO(tsk) \ | |
58 | { \ | |
59 | .uwinmask = 0, \ | |
60 | .task = &tsk, \ | |
f5e706ad SR |
61 | .flags = 0, \ |
62 | .cpu = 0, \ | |
c99e6efe | 63 | .preempt_count = INIT_PREEMPT_COUNT, \ |
f5e706ad SR |
64 | } |
65 | ||
66 | #define init_thread_info (init_thread_union.thread_info) | |
67 | #define init_stack (init_thread_union.stack) | |
68 | ||
69 | /* how to get the thread information struct from C */ | |
70 | register struct thread_info *current_thread_info_reg asm("g6"); | |
71 | #define current_thread_info() (current_thread_info_reg) | |
72 | ||
73 | /* | |
74 | * thread information allocation | |
75 | */ | |
29af0eba | 76 | #define THREAD_SIZE_ORDER 1 |
f5e706ad SR |
77 | |
78 | #endif /* __ASSEMBLY__ */ | |
79 | ||
29af0eba | 80 | /* Size of kernel stack for each process */ |
a4b4f437 | 81 | #define THREAD_SIZE (2 * PAGE_SIZE) |
f5e706ad SR |
82 | |
83 | /* | |
84 | * Offsets in thread_info structure, used in assembly code | |
85 | * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications. | |
86 | */ | |
87 | #define TI_UWINMASK 0x00 /* uwinmask */ | |
88 | #define TI_TASK 0x04 | |
14464772 RW |
89 | #define TI_FLAGS 0x08 |
90 | #define TI_CPU 0x0c | |
91 | #define TI_PREEMPT 0x10 /* preempt_count */ | |
92 | #define TI_SOFTIRQ 0x14 /* softirq_count */ | |
93 | #define TI_HARDIRQ 0x18 /* hardirq_count */ | |
720d7071 GR |
94 | #define TI_KSP 0x20 /* ksp */ |
95 | #define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */ | |
96 | #define TI_KPSR 0x28 /* kpsr */ | |
97 | #define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */ | |
98 | #define TI_REG_WINDOW 0x30 | |
99 | #define TI_RWIN_SPTRS 0x230 | |
100 | #define TI_W_SAVED 0x250 | |
f5e706ad | 101 | |
f5e706ad SR |
102 | /* |
103 | * thread information flag bit numbers | |
104 | */ | |
105 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | |
5a157d5b | 106 | #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ |
f5e706ad SR |
107 | #define TIF_SIGPENDING 2 /* signal pending */ |
108 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | |
109 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | |
110 | #define TIF_USEDFPU 8 /* FPU was used by this task | |
111 | * this quantum (SMP) */ | |
112 | #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling | |
113 | * TIF_NEED_RESCHED */ | |
0ddc9324 | 114 | #define TIF_MEMDIE 10 /* is terminating due to OOM killer */ |
f5e706ad SR |
115 | |
116 | /* as above, but as bit values */ | |
117 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | |
5a157d5b | 118 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
f5e706ad SR |
119 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
120 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | |
f5e706ad SR |
121 | #define _TIF_USEDFPU (1<<TIF_USEDFPU) |
122 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | |
123 | ||
5a157d5b | 124 | #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \ |
6fd84c08 | 125 | _TIF_SIGPENDING) |
5a157d5b | 126 | |
a17c8b54 EP |
127 | #define is_32bit_task() (1) |
128 | ||
f5e706ad SR |
129 | #endif /* __KERNEL__ */ |
130 | ||
131 | #endif /* _ASM_THREAD_INFO_H */ |