Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2/* thread_info.h: CRIS low-level thread information
3 *
4 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
5 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
6 *
7 * CRIS port by Axis Communications
8 */
9
10#ifndef _ASM_THREAD_INFO_H
11#define _ASM_THREAD_INFO_H
12
13#ifdef __KERNEL__
14
15#ifndef __ASSEMBLY__
16#include <asm/types.h>
17#include <asm/processor.h>
18#include <arch/thread_info.h>
19#include <asm/segment.h>
20#endif
21
22
23/* THREAD_SIZE is the size of the thread_info/kernel_stack combo.
24 * normally, the stack is found by doing something like p + THREAD_SIZE
25 * in CRIS, a page is 8192 bytes, which seems like a sane size
26 */
27#define THREAD_SIZE PAGE_SIZE
28#define THREAD_SIZE_ORDER (0)
29
30/*
31 * low level task data that entry.S needs immediate access to
32 * - this struct should fit entirely inside of one cache line
33 * - this struct shares the supervisor stack pages
34 * - if the contents of this structure are changed, the assembly constants must also be changed
35 */
36#ifndef __ASSEMBLY__
37struct thread_info {
38 struct task_struct *task; /* main task structure */
39 unsigned long flags; /* low level flags */
40 __u32 cpu; /* current CPU */
41 int preempt_count; /* 0 => preemptable, <0 => BUG */
42 __u32 tls; /* TLS for this thread */
43
44 mm_segment_t addr_limit; /* thread address space:
45 0-0xBFFFFFFF for user-thead
46 0-0xFFFFFFFF for kernel-thread
47 */
48 __u8 supervisor_stack[0];
49};
50
51#endif
52
53/*
54 * macros/functions for gaining access to the thread information structure
55 */
56#ifndef __ASSEMBLY__
57#define INIT_THREAD_INFO(tsk) \
58{ \
59 .task = &tsk, \
60 .flags = 0, \
61 .cpu = 0, \
62 .preempt_count = INIT_PREEMPT_COUNT, \
63 .addr_limit = KERNEL_DS, \
64}
65
66#endif /* !__ASSEMBLY__ */
67
68/*
69 * thread information flags
70 * - these are process state flags that various assembly files may need to access
71 * - pending work-to-be-done flags are in LSW
72 * - other flags in MSW
73 */
74#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
75#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
76#define TIF_SIGPENDING 2 /* signal pending */
77#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
78#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
79#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
80
81#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
82#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
83#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
84#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
85
86#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
87#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
88
89#endif /* __KERNEL__ */
90
91#endif /* _ASM_THREAD_INFO_H */