thread_info.h 2.3 KB
Newer Older
G
Guo Ren 已提交
1 2 3 4 5 6 7 8 9 10 11 12
/* SPDX-License-Identifier: GPL-2.0 */
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.

#ifndef _ASM_CSKY_THREAD_INFO_H
#define _ASM_CSKY_THREAD_INFO_H

#ifndef __ASSEMBLY__

#include <linux/version.h>
#include <asm/types.h>
#include <asm/page.h>
#include <asm/processor.h>
G
Guo Ren 已提交
13
#include <abi/switch_context.h>
G
Guo Ren 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

struct thread_info {
	struct task_struct	*task;
	void			*dump_exec_domain;
	unsigned long		flags;
	int			preempt_count;
	unsigned long		tp_value;
	mm_segment_t		addr_limit;
	struct restart_block	restart_block;
	struct pt_regs		*regs;
	unsigned int		cpu;
};

#define INIT_THREAD_INFO(tsk)			\
{						\
	.task		= &tsk,			\
	.preempt_count  = INIT_PREEMPT_COUNT,	\
	.addr_limit     = KERNEL_DS,		\
	.cpu		= 0,			\
	.restart_block = {			\
		.fn = do_no_restart_syscall,	\
	},					\
}

#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)

G
Guo Ren 已提交
40 41 42
#define thread_saved_fp(tsk) \
	((unsigned long)(((struct switch_stack *)(tsk->thread.ksp))->r8))

G
Guo Ren 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56
static inline struct thread_info *current_thread_info(void)
{
	unsigned long sp;

	asm volatile("mov %0, sp\n":"=r"(sp));

	return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
}

#endif /* !__ASSEMBLY__ */

#define TIF_SIGPENDING		0	/* signal pending */
#define TIF_NOTIFY_RESUME	1       /* callback before returning to user */
#define TIF_NEED_RESCHED	2	/* rescheduling necessary */
57 58 59
#define TIF_SYSCALL_TRACE	3	/* syscall trace active */
#define TIF_SYSCALL_TRACEPOINT	4       /* syscall tracepoint instrumentation */
#define TIF_SYSCALL_AUDIT	5	/* syscall auditing */
G
Guo Ren 已提交
60 61 62 63 64
#define TIF_POLLING_NRFLAG	16	/* poll_idle() is TIF_NEED_RESCHED */
#define TIF_MEMDIE		18      /* is terminating due to OOM killer */
#define TIF_RESTORE_SIGMASK	20	/* restore signal mask in do_signal() */
#define TIF_SECCOMP		21	/* secure computing */

65 66 67 68 69 70 71
#define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
#define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
#define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
#define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_TRACEPOINT	(1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_SYSCALL_AUDIT	(1 << TIF_SYSCALL_AUDIT)
#define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
G
Guo Ren 已提交
72
#define _TIF_MEMDIE		(1 << TIF_MEMDIE)
73 74
#define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)
#define _TIF_SECCOMP		(1 << TIF_SECCOMP)
G
Guo Ren 已提交
75 76

#endif	/* _ASM_CSKY_THREAD_INFO_H */