Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / unicore32 / include / asm / thread_info.h
blob5fb728f3b49a7e8626b5b0b57db422b4a116eb53
1 /*
2 * linux/arch/unicore32/include/asm/thread_info.h
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #ifndef __UNICORE_THREAD_INFO_H__
13 #define __UNICORE_THREAD_INFO_H__
15 #ifdef __KERNEL__
17 #include <linux/compiler.h>
18 #include <asm/fpstate.h>
20 #define THREAD_SIZE_ORDER 1
21 #define THREAD_SIZE 8192
22 #define THREAD_START_SP (THREAD_SIZE - 8)
24 #ifndef __ASSEMBLY__
26 struct task_struct;
28 #include <asm/types.h>
30 typedef struct {
31 unsigned long seg;
32 } mm_segment_t;
34 struct cpu_context_save {
35 __u32 r4;
36 __u32 r5;
37 __u32 r6;
38 __u32 r7;
39 __u32 r8;
40 __u32 r9;
41 __u32 r10;
42 __u32 r11;
43 __u32 r12;
44 __u32 r13;
45 __u32 r14;
46 __u32 r15;
47 __u32 r16;
48 __u32 r17;
49 __u32 r18;
50 __u32 r19;
51 __u32 r20;
52 __u32 r21;
53 __u32 r22;
54 __u32 r23;
55 __u32 r24;
56 __u32 r25;
57 __u32 r26;
58 __u32 fp;
59 __u32 sp;
60 __u32 pc;
64 * low level task data that entry.S needs immediate access to.
65 * __switch_to() assumes cpu_context follows immediately after cpu_domain.
67 struct thread_info {
68 unsigned long flags; /* low level flags */
69 int preempt_count; /* 0 => preemptable */
70 /* <0 => bug */
71 mm_segment_t addr_limit; /* address limit */
72 struct task_struct *task; /* main task structure */
73 __u32 cpu; /* cpu */
74 struct cpu_context_save cpu_context; /* cpu context */
75 __u32 syscall; /* syscall number */
76 __u8 used_cp[16]; /* thread used copro */
77 #ifdef CONFIG_UNICORE_FPU_F64
78 struct fp_state fpstate __attribute__((aligned(8)));
79 #endif
82 #define INIT_THREAD_INFO(tsk) \
83 { \
84 .task = &tsk, \
85 .flags = 0, \
86 .preempt_count = INIT_PREEMPT_COUNT, \
87 .addr_limit = KERNEL_DS, \
91 * how to get the thread information struct from C
93 static inline struct thread_info *current_thread_info(void) __attribute_const__;
95 static inline struct thread_info *current_thread_info(void)
97 register unsigned long sp asm ("sp");
98 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
101 #define thread_saved_pc(tsk) \
102 ((unsigned long)(task_thread_info(tsk)->cpu_context.pc))
103 #define thread_saved_sp(tsk) \
104 ((unsigned long)(task_thread_info(tsk)->cpu_context.sp))
105 #define thread_saved_fp(tsk) \
106 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
108 #endif
111 * thread information flags:
112 * TIF_SYSCALL_TRACE - syscall trace active
113 * TIF_SIGPENDING - signal pending
114 * TIF_NEED_RESCHED - rescheduling necessary
115 * TIF_NOTIFY_RESUME - callback before returning to user
117 #define TIF_SIGPENDING 0
118 #define TIF_NEED_RESCHED 1
119 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
120 #define TIF_SYSCALL_TRACE 8
121 #define TIF_MEMDIE 18
122 #define TIF_RESTORE_SIGMASK 20
124 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
125 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
126 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
127 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
130 * Change these and you break ASM code in entry-common.S
132 #define _TIF_WORK_MASK \
133 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
135 #endif /* __KERNEL__ */
136 #endif /* __UNICORE_THREAD_INFO_H__ */