1#ifndef _ASM_SCORE_THREAD_INFO_H
2#define _ASM_SCORE_THREAD_INFO_H
3
4#ifdef __KERNEL__
5
6#define KU_MASK	0x08
7#define KU_USER	0x08
8#define KU_KERN	0x00
9
10#include <asm/page.h>
11#include <linux/const.h>
12
13/* thread information allocation */
14#define THREAD_SIZE_ORDER	(1)
15#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
16#define THREAD_MASK		(THREAD_SIZE - _AC(1,UL))
17
18#ifndef __ASSEMBLY__
19
20#include <asm/processor.h>
21
22/*
23 * low level task data that entry.S needs immediate access to
24 * - this struct should fit entirely inside of one cache line
25 * - this struct shares the supervisor stack pages
26 * - if the contents of this structure are changed, the assembly constants
27 *   must also be changed
28 */
29struct thread_info {
30	struct task_struct	*task;		/* main task structure */
31	unsigned long		flags;		/* low level flags */
32	unsigned long		tp_value;	/* thread pointer */
33	__u32			cpu;		/* current CPU */
34
35	/* 0 => preemptable, < 0 => BUG */
36	int			preempt_count;
37
38	/*
39	 * thread address space:
40	 * 0-0xBFFFFFFF for user-thead
41	 * 0-0xFFFFFFFF for kernel-thread
42	 */
43	mm_segment_t		addr_limit;
44	struct pt_regs		*regs;
45};
46
47/*
48 * macros/functions for gaining access to the thread information structure
49 *
50 * preempt_count needs to be 1 initially, until the scheduler is functional.
51 */
52#define INIT_THREAD_INFO(tsk)			\
53{						\
54	.task		= &tsk,			\
55	.cpu		= 0,			\
56	.preempt_count	= 1,			\
57	.addr_limit	= KERNEL_DS,		\
58}
59
60#define init_thread_info	(init_thread_union.thread_info)
61#define init_stack		(init_thread_union.stack)
62
63/* How to get the thread information struct from C. */
64register struct thread_info *__current_thread_info __asm__("r28");
65#define current_thread_info()	__current_thread_info
66
67#endif /* !__ASSEMBLY__ */
68
69/*
70 * thread information flags
71 * - these are process state flags that various assembly files may need to
72 *   access
73 * - pending work-to-be-done flags are in LSW
74 * - other flags in MSW
75 */
76#define TIF_SYSCALL_TRACE	0	/* syscall trace active */
77#define TIF_SIGPENDING		1	/* signal pending */
78#define TIF_NEED_RESCHED	2	/* rescheduling necessary */
79#define TIF_NOTIFY_RESUME	5	/* callback before returning to user */
80#define TIF_RESTORE_SIGMASK	9	/* restore signal mask in do_signal() */
81#define TIF_MEMDIE		18	/* is terminating due to OOM killer */
82
83#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
84#define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
85#define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
86#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
87
88#define _TIF_WORK_MASK		(0x0000ffff)
89
90#endif /* __KERNEL__ */
91
92#endif /* _ASM_SCORE_THREAD_INFO_H */
93