]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - arch/alpha/include/asm/thread_info.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-kernels.git] / arch / alpha / include / asm / thread_info.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef _ALPHA_THREAD_INFO_H
3#define _ALPHA_THREAD_INFO_H
4
5#ifdef __KERNEL__
6
7#ifndef __ASSEMBLY__
8#include <asm/processor.h>
9#include <asm/types.h>
10#include <asm/hwrpb.h>
3185bd26 11#include <asm/sysinfo.h>
1da177e4
LT
12#endif
13
14#ifndef __ASSEMBLY__
15struct thread_info {
16 struct pcb_struct pcb; /* palcode state */
17
18 struct task_struct *task; /* main task structure */
19 unsigned int flags; /* low level flags */
20 unsigned int ieee_state; /* see fpu.h */
21
1da177e4
LT
22 mm_segment_t addr_limit; /* thread address space */
23 unsigned cpu; /* current CPU */
24 int preempt_count; /* 0 => preemptable, <0 => BUG */
3185bd26 25 unsigned int status; /* thread-synchronous flags */
1da177e4
LT
26
27 int bpt_nsaved;
28 unsigned long bpt_addr[2]; /* breakpoint handling */
29 unsigned int bpt_insn[2];
1da177e4
LT
30};
31
32/*
33 * Macros/functions for gaining access to the thread information structure.
34 */
35#define INIT_THREAD_INFO(tsk) \
36{ \
37 .task = &tsk, \
1da177e4 38 .addr_limit = KERNEL_DS, \
c99e6efe 39 .preempt_count = INIT_PREEMPT_COUNT, \
1da177e4
LT
40}
41
42#define init_thread_info (init_thread_union.thread_info)
43#define init_stack (init_thread_union.stack)
44
45/* How to get the thread information struct from C. */
46register struct thread_info *__current_thread_info __asm__("$8");
47#define current_thread_info() __current_thread_info
48
15f3c476
AM
49#endif /* __ASSEMBLY__ */
50
1da177e4 51/* Thread information allocation. */
b69c49b7 52#define THREAD_SIZE_ORDER 1
1da177e4 53#define THREAD_SIZE (2*PAGE_SIZE)
1da177e4 54
1da177e4
LT
55/*
56 * Thread information flags:
57 * - these are process state flags and used from assembly
745dd240
MC
58 * - pending work-to-be-done flags come first and must be assigned to be
59 * within bits 0 to 7 to fit in and immediate operand.
1da177e4
LT
60 *
61 * TIF_SYSCALL_TRACE is known to be 0 via blbs.
62 */
63#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
745dd240
MC
64#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
65#define TIF_SIGPENDING 2 /* signal pending */
66#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
a9302e84 67#define TIF_SYSCALL_AUDIT 4 /* syscall audit active */
745dd240 68#define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
0ddc9324 69#define TIF_MEMDIE 13 /* is terminating due to OOM killer */
2a705ad6 70#define TIF_POLLING_NRFLAG 14 /* idle is polling for TIF_NEED_RESCHED */
1da177e4
LT
71
72#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
1da177e4
LT
73#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
74#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
d0420c83 75#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
a9302e84 76#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
2a705ad6 77#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
1da177e4
LT
78
79/* Work to do on interrupt/exception return. */
d0420c83
DH
80#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
81 _TIF_NOTIFY_RESUME)
1da177e4
LT
82
83/* Work to do on any return to userspace. */
84#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
85 | _TIF_SYSCALL_TRACE)
86
3185bd26
AV
87#define TS_UAC_NOPRINT 0x0001 /* ! Preserve the following three */
88#define TS_UAC_NOFIX 0x0002 /* ! flags as they match */
89#define TS_UAC_SIGBUS 0x0004 /* ! userspace part of 'osf_sysinfo' */
3185bd26
AV
90
91#define SET_UNALIGN_CTL(task,value) ({ \
92 __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
93 if (value & PR_UNALIGN_NOPRINT) \
94 status |= TS_UAC_NOPRINT; \
95 if (value & PR_UNALIGN_SIGBUS) \
96 status |= TS_UAC_SIGBUS; \
97 if (value & 4) /* alpha-specific */ \
98 status |= TS_UAC_NOFIX; \
99 task_thread_info(task)->status = status; \
ed58a593
IK
100 0; })
101
102#define GET_UNALIGN_CTL(task,value) ({ \
3185bd26
AV
103 __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
104 __u32 res = 0; \
105 if (status & TS_UAC_NOPRINT) \
106 res |= PR_UNALIGN_NOPRINT; \
107 if (status & TS_UAC_SIGBUS) \
108 res |= PR_UNALIGN_SIGBUS; \
109 if (status & TS_UAC_NOFIX) \
110 res |= 4; \
111 put_user(res, (int __user *)(value)); \
ed58a593
IK
112 })
113
1da177e4
LT
114#endif /* __KERNEL__ */
115#endif /* _ALPHA_THREAD_INFO_H */