1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/include/asm/thread_info.h
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 #ifndef __UNICORE_THREAD_INFO_H__
10 #define __UNICORE_THREAD_INFO_H__
14 #include <linux/compiler.h>
15 #include <asm/fpstate.h>
17 #define THREAD_SIZE_ORDER 1
18 #define THREAD_SIZE 8192
19 #define THREAD_START_SP (THREAD_SIZE - 8)
25 #include <asm/types.h>
31 struct cpu_context_save {
61 * low level task data that entry.S needs immediate access to.
62 * __switch_to() assumes cpu_context follows immediately after cpu_domain.
65 unsigned long flags; /* low level flags */
66 int preempt_count; /* 0 => preemptable */
68 mm_segment_t addr_limit; /* address limit */
69 struct task_struct *task; /* main task structure */
71 struct cpu_context_save cpu_context; /* cpu context */
72 __u32 syscall; /* syscall number */
73 __u8 used_cp[16]; /* thread used copro */
74 #ifdef CONFIG_UNICORE_FPU_F64
75 struct fp_state fpstate __attribute__((aligned(8)));
79 #define INIT_THREAD_INFO(tsk) \
83 .preempt_count = INIT_PREEMPT_COUNT, \
84 .addr_limit = KERNEL_DS, \
88 * how to get the thread information struct from C
90 static inline struct thread_info *current_thread_info(void) __attribute_const__;
92 static inline struct thread_info *current_thread_info(void)
94 register unsigned long sp asm ("sp");
95 return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
98 #define thread_saved_pc(tsk) \
99 ((unsigned long)(task_thread_info(tsk)->cpu_context.pc))
100 #define thread_saved_sp(tsk) \
101 ((unsigned long)(task_thread_info(tsk)->cpu_context.sp))
102 #define thread_saved_fp(tsk) \
103 ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
108 * thread information flags:
109 * TIF_SYSCALL_TRACE - syscall trace active
110 * TIF_SIGPENDING - signal pending
111 * TIF_NEED_RESCHED - rescheduling necessary
112 * TIF_NOTIFY_RESUME - callback before returning to user
114 #define TIF_SIGPENDING 0
115 #define TIF_NEED_RESCHED 1
116 #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
117 #define TIF_SYSCALL_TRACE 8
118 #define TIF_MEMDIE 18
119 #define TIF_RESTORE_SIGMASK 20
121 #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
122 #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
123 #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
124 #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
127 * Change these and you break ASM code in entry-common.S
129 #define _TIF_WORK_MASK \
130 (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
132 #endif /* __KERNEL__ */
133 #endif /* __UNICORE_THREAD_INFO_H__ */