Loading...
Note: File does not exist in v6.2.
1#ifndef _ASM_M32R_THREAD_INFO_H
2#define _ASM_M32R_THREAD_INFO_H
3
4/* thread_info.h: m32r low-level thread information
5 *
6 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
7 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
8 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
9 */
10
11#ifdef __KERNEL__
12
13#ifndef __ASSEMBLY__
14#include <asm/processor.h>
15#endif
16
17/*
18 * low level task data that entry.S needs immediate access to
19 * - this struct should fit entirely inside of one cache line
20 * - this struct shares the supervisor stack pages
21 * - if the contents of this structure are changed, the assembly constants must also be changed
22 */
23#ifndef __ASSEMBLY__
24
25struct thread_info {
26 struct task_struct *task; /* main task structure */
27 unsigned long flags; /* low level flags */
28 unsigned long status; /* thread-synchronous flags */
29 __u32 cpu; /* current CPU */
30 int preempt_count; /* 0 => preemptable, <0 => BUG */
31
32 mm_segment_t addr_limit; /* thread address space:
33 0-0xBFFFFFFF for user-thread
34 0-0xFFFFFFFF for kernel-thread
35 */
36
37 __u8 supervisor_stack[0];
38};
39
40#endif /* !__ASSEMBLY__ */
41
42#define THREAD_SIZE (PAGE_SIZE << 1)
43#define THREAD_SIZE_ORDER 1
44/*
45 * macros/functions for gaining access to the thread information structure
46 */
47#ifndef __ASSEMBLY__
48
49#define INIT_THREAD_INFO(tsk) \
50{ \
51 .task = &tsk, \
52 .flags = 0, \
53 .cpu = 0, \
54 .preempt_count = INIT_PREEMPT_COUNT, \
55 .addr_limit = KERNEL_DS, \
56}
57
58#define init_thread_info (init_thread_union.thread_info)
59#define init_stack (init_thread_union.stack)
60
61/* how to get the thread information struct from C */
62static inline struct thread_info *current_thread_info(void)
63{
64 struct thread_info *ti;
65
66 __asm__ __volatile__ (
67 "ldi %0, #%1 \n\t"
68 "and %0, sp \n\t"
69 : "=r" (ti) : "i" (~(THREAD_SIZE - 1))
70 );
71
72 return ti;
73}
74
75#define TI_FLAG_FAULT_CODE_SHIFT 28
76
77static inline void set_thread_fault_code(unsigned int val)
78{
79 struct thread_info *ti = current_thread_info();
80 ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
81 | (val << TI_FLAG_FAULT_CODE_SHIFT);
82}
83
84static inline unsigned int get_thread_fault_code(void)
85{
86 struct thread_info *ti = current_thread_info();
87 return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT;
88}
89
90#endif
91
92/*
93 * thread information flags
94 * - these are process state flags that various assembly files may need to access
95 * - pending work-to-be-done flags are in LSW
96 * - other flags in MSW
97 */
98#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
99#define TIF_SIGPENDING 1 /* signal pending */
100#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
101#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
102#define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
103#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */
104#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
105#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
106
107#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
108#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
109#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
110#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
111#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
112#define _TIF_USEDFPU (1<<TIF_USEDFPU)
113
114#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
115#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
116
117/*
118 * Thread-synchronous status.
119 *
120 * This is different from the flags in that nobody else
121 * ever touches our thread-synchronous status, so we don't
122 * have to worry about atomic accesses.
123 */
124#define TS_USEDFPU 0x0001 /* FPU was used by this task this quantum (SMP) */
125
126#endif /* __KERNEL__ */
127
128#endif /* _ASM_M32R_THREAD_INFO_H */