WIP FPC-III support
[linux/fpc-iii.git] / arch / openrisc / include / asm / thread_info.h
blob4f9d2a26145584da003193414d43bbbd59e19b48
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * OpenRISC Linux
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
7 * declaration.
9 * OpenRISC implementation:
10 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12 * et al.
15 #ifndef _ASM_THREAD_INFO_H
16 #define _ASM_THREAD_INFO_H
18 #ifdef __KERNEL__
20 #ifndef __ASSEMBLY__
21 #include <asm/types.h>
22 #include <asm/processor.h>
23 #endif
26 /* THREAD_SIZE is the size of the task_struct/kernel_stack combo.
27 * normally, the stack is found by doing something like p + THREAD_SIZE
28 * in or32, a page is 8192 bytes, which seems like a sane size
31 #define THREAD_SIZE_ORDER 0
32 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
35 * low level task data that entry.S needs immediate access to
36 * - this struct should fit entirely inside of one cache line
37 * - this struct shares the supervisor stack pages
38 * - if the contents of this structure are changed, the assembly constants
39 * must also be changed
41 #ifndef __ASSEMBLY__
43 typedef unsigned long mm_segment_t;
45 struct thread_info {
46 struct task_struct *task; /* main task structure */
47 unsigned long flags; /* low level flags */
48 __u32 cpu; /* current CPU */
49 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
51 mm_segment_t addr_limit; /* thread address space:
52 0-0x7FFFFFFF for user-thead
53 0-0xFFFFFFFF for kernel-thread
55 __u8 supervisor_stack[0];
57 /* saved context data */
58 unsigned long ksp;
60 #endif
63 * macros/functions for gaining access to the thread information structure
65 * preempt_count needs to be 1 initially, until the scheduler is functional.
67 #ifndef __ASSEMBLY__
68 #define INIT_THREAD_INFO(tsk) \
69 { \
70 .task = &tsk, \
71 .flags = 0, \
72 .cpu = 0, \
73 .preempt_count = INIT_PREEMPT_COUNT, \
74 .addr_limit = KERNEL_DS, \
75 .ksp = 0, \
78 /* how to get the thread information struct from C */
79 register struct thread_info *current_thread_info_reg asm("r10");
80 #define current_thread_info() (current_thread_info_reg)
82 #define get_thread_info(ti) get_task_struct((ti)->task)
83 #define put_thread_info(ti) put_task_struct((ti)->task)
85 #endif /* !__ASSEMBLY__ */
88 * thread information flags
89 * these are process state flags that various assembly files may need to
90 * access
91 * - pending work-to-be-done flags are in LSW
92 * - other flags in MSW
94 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
95 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
96 #define TIF_SIGPENDING 2 /* signal pending */
97 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
98 #define TIF_SINGLESTEP 4 /* restore singlestep on return to user
99 * mode
101 #define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */
102 #define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */
103 #define TIF_RESTORE_SIGMASK 9
104 #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling * TIF_NEED_RESCHED
106 #define TIF_MEMDIE 17
108 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
109 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
110 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
111 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
112 #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
113 #define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)
114 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
117 /* Work to do when returning from interrupt/exception */
118 /* For OpenRISC, this is anything in the LSW other than syscall trace */
119 #define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP))
121 #endif /* __KERNEL__ */
123 #endif /* _ASM_THREAD_INFO_H */