GNU Linux-libre 4.14.328-gnu1
[releases.git] / arch / cris / include / asm / thread_info.h
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 /*
24  * low level task data that entry.S needs immediate access to
25  * - this struct should fit entirely inside of one cache line
26  * - this struct shares the supervisor stack pages
27  * - if the contents of this structure are changed, the assembly constants must also be changed
28  */
29 #ifndef __ASSEMBLY__
30 struct thread_info {
31         struct task_struct      *task;          /* main task structure */
32         unsigned long           flags;          /* low level flags */
33         __u32                   cpu;            /* current CPU */
34         int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
35         __u32                   tls;            /* TLS for this thread */
36
37         mm_segment_t            addr_limit;     /* thread address space:
38                                                    0-0xBFFFFFFF for user-thead
39                                                    0-0xFFFFFFFF for kernel-thread
40                                                 */
41         __u8                    supervisor_stack[0];
42 };
43
44 #endif
45
46 /*
47  * macros/functions for gaining access to the thread information structure
48  */
49 #ifndef __ASSEMBLY__
50 #define INIT_THREAD_INFO(tsk)                           \
51 {                                                       \
52         .task           = &tsk,                         \
53         .flags          = 0,                            \
54         .cpu            = 0,                            \
55         .preempt_count  = INIT_PREEMPT_COUNT,           \
56         .addr_limit     = KERNEL_DS,                    \
57 }
58
59 #define init_thread_info        (init_thread_union.thread_info)
60
61 #endif /* !__ASSEMBLY__ */
62
63 /*
64  * thread information flags
65  * - these are process state flags that various assembly files may need to access
66  * - pending work-to-be-done flags are in LSW
67  * - other flags in MSW
68  */
69 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
70 #define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
71 #define TIF_SIGPENDING          2       /* signal pending */
72 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
73 #define TIF_RESTORE_SIGMASK     9       /* restore signal mask in do_signal() */
74 #define TIF_MEMDIE              17      /* is terminating due to OOM killer */
75
76 #define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
77 #define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
78 #define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
79 #define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
80
81 #define _TIF_WORK_MASK          0x0000FFFE      /* work to do on interrupt/exception return */
82 #define _TIF_ALLWORK_MASK       0x0000FFFF      /* work to do on any return to u-space */
83
84 #endif /* __KERNEL__ */
85
86 #endif /* _ASM_THREAD_INFO_H */