18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci// Copyright (C) 2005-2017 Andes Technology Corporation
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __ASM_NDS32_THREAD_INFO_H
58c2ecf20Sopenharmony_ci#define __ASM_NDS32_THREAD_INFO_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifdef __KERNEL__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define THREAD_SIZE_ORDER 	(1)
108c2ecf20Sopenharmony_ci#define THREAD_SIZE		(PAGE_SIZE << THREAD_SIZE_ORDER)
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct task_struct;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
178c2ecf20Sopenharmony_ci#include <asm/types.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_citypedef unsigned long mm_segment_t;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * low level task data that entry.S needs immediate access to.
238c2ecf20Sopenharmony_ci * __switch_to() assumes cpu_context follows immediately after cpu_domain.
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_cistruct thread_info {
268c2ecf20Sopenharmony_ci	unsigned long flags;	/* low level flags */
278c2ecf20Sopenharmony_ci	__s32 preempt_count;	/* 0 => preemptable, <0 => bug */
288c2ecf20Sopenharmony_ci	mm_segment_t addr_limit;	/* address limit */
298c2ecf20Sopenharmony_ci};
308c2ecf20Sopenharmony_ci#define INIT_THREAD_INFO(tsk)						\
318c2ecf20Sopenharmony_ci{									\
328c2ecf20Sopenharmony_ci	.preempt_count	= INIT_PREEMPT_COUNT,				\
338c2ecf20Sopenharmony_ci	.addr_limit	= KERNEL_DS,					\
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci#define thread_saved_pc(tsk) ((unsigned long)(tsk->thread.cpu_context.pc))
368c2ecf20Sopenharmony_ci#define thread_saved_fp(tsk) ((unsigned long)(tsk->thread.cpu_context.fp))
378c2ecf20Sopenharmony_ci#endif
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/*
408c2ecf20Sopenharmony_ci * thread information flags:
418c2ecf20Sopenharmony_ci *  TIF_SYSCALL_TRACE	- syscall trace active
428c2ecf20Sopenharmony_ci *  TIF_SIGPENDING	- signal pending
438c2ecf20Sopenharmony_ci *  TIF_NEED_RESCHED	- rescheduling necessary
448c2ecf20Sopenharmony_ci *  TIF_NOTIFY_RESUME	- callback before returning to user
458c2ecf20Sopenharmony_ci *  TIF_POLLING_NRFLAG	- true if poll_idle() is polling TIF_NEED_RESCHED
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ci#define TIF_SIGPENDING		1
488c2ecf20Sopenharmony_ci#define TIF_NEED_RESCHED	2
498c2ecf20Sopenharmony_ci#define TIF_SINGLESTEP		3
508c2ecf20Sopenharmony_ci#define TIF_NOTIFY_RESUME	4	/* callback before returning to user */
518c2ecf20Sopenharmony_ci#define TIF_NOTIFY_SIGNAL	5	/* signal notifications exist */
528c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACE	8
538c2ecf20Sopenharmony_ci#define TIF_POLLING_NRFLAG	17
548c2ecf20Sopenharmony_ci#define TIF_MEMDIE		18
558c2ecf20Sopenharmony_ci#define TIF_FREEZE		19
568c2ecf20Sopenharmony_ci#define TIF_RESTORE_SIGMASK	20
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#define _TIF_SIGPENDING		(1 << TIF_SIGPENDING)
598c2ecf20Sopenharmony_ci#define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
608c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
618c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_SIGNAL	(1 << TIF_NOTIFY_SIGNAL)
628c2ecf20Sopenharmony_ci#define _TIF_SINGLESTEP		(1 << TIF_SINGLESTEP)
638c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACE	(1 << TIF_SYSCALL_TRACE)
648c2ecf20Sopenharmony_ci#define _TIF_POLLING_NRFLAG	(1 << TIF_POLLING_NRFLAG)
658c2ecf20Sopenharmony_ci#define _TIF_FREEZE		(1 << TIF_FREEZE)
668c2ecf20Sopenharmony_ci#define _TIF_RESTORE_SIGMASK	(1 << TIF_RESTORE_SIGMASK)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci/*
698c2ecf20Sopenharmony_ci * Change these and you break ASM code in entry-common.S
708c2ecf20Sopenharmony_ci */
718c2ecf20Sopenharmony_ci#define _TIF_WORK_MASK		0x000000ff
728c2ecf20Sopenharmony_ci#define _TIF_WORK_SYSCALL_ENTRY (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)
738c2ecf20Sopenharmony_ci#define _TIF_WORK_SYSCALL_LEAVE (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
768c2ecf20Sopenharmony_ci#endif /* __ASM_NDS32_THREAD_INFO_H */
77