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__
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)
29 #include <asm/types.h>
35 struct cpu_context_save
{
65 * low level task data that entry.S needs immediate access to.
66 * __switch_to() assumes cpu_context follows immediately after cpu_domain.
69 unsigned long flags
; /* low level flags */
70 int preempt_count
; /* 0 => preemptable */
72 mm_segment_t addr_limit
; /* address limit */
73 struct task_struct
*task
; /* main task structure */
74 struct exec_domain
*exec_domain
; /* execution domain */
76 struct cpu_context_save cpu_context
; /* cpu context */
77 __u32 syscall
; /* syscall number */
78 __u8 used_cp
[16]; /* thread used copro */
79 #ifdef CONFIG_UNICORE_FPU_F64
80 struct fp_state fpstate
__attribute__((aligned(8)));
82 struct restart_block restart_block
;
85 #define INIT_THREAD_INFO(tsk) \
88 .exec_domain = &default_exec_domain, \
90 .preempt_count = INIT_PREEMPT_COUNT, \
91 .addr_limit = KERNEL_DS, \
93 .fn = do_no_restart_syscall, \
97 #define init_thread_info (init_thread_union.thread_info)
98 #define init_stack (init_thread_union.stack)
101 * how to get the thread information struct from C
103 static inline struct thread_info
*current_thread_info(void) __attribute_const__
;
105 static inline struct thread_info
*current_thread_info(void)
107 register unsigned long sp
asm ("sp");
108 return (struct thread_info
*)(sp
& ~(THREAD_SIZE
- 1));
111 #define thread_saved_pc(tsk) \
112 ((unsigned long)(task_thread_info(tsk)->cpu_context.pc))
113 #define thread_saved_sp(tsk) \
114 ((unsigned long)(task_thread_info(tsk)->cpu_context.sp))
115 #define thread_saved_fp(tsk) \
116 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
121 * We use bit 30 of the preempt_count to indicate that kernel
122 * preemption is occurring. See <asm/hardirq.h>.
124 #define PREEMPT_ACTIVE 0x40000000
127 * thread information flags:
128 * TIF_SYSCALL_TRACE - syscall trace active
129 * TIF_SIGPENDING - signal pending
130 * TIF_NEED_RESCHED - rescheduling necessary
131 * TIF_NOTIFY_RESUME - callback before returning to user
133 #define TIF_SIGPENDING 0
134 #define TIF_NEED_RESCHED 1
135 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
136 #define TIF_SYSCALL_TRACE 8
137 #define TIF_MEMDIE 18
138 #define TIF_RESTORE_SIGMASK 20
140 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
141 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
142 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
143 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
144 #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
147 * Change these and you break ASM code in entry-common.S
149 #define _TIF_WORK_MASK 0x000000ff
151 #endif /* __KERNEL__ */
152 #endif /* __UNICORE_THREAD_INFO_H__ */