162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci#ifndef _ASM_CSKY_THREAD_INFO_H 462306a36Sopenharmony_ci#define _ASM_CSKY_THREAD_INFO_H 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#include <asm/types.h> 962306a36Sopenharmony_ci#include <asm/page.h> 1062306a36Sopenharmony_ci#include <asm/processor.h> 1162306a36Sopenharmony_ci#include <abi/switch_context.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cistruct thread_info { 1462306a36Sopenharmony_ci struct task_struct *task; 1562306a36Sopenharmony_ci void *dump_exec_domain; 1662306a36Sopenharmony_ci unsigned long flags; 1762306a36Sopenharmony_ci int preempt_count; 1862306a36Sopenharmony_ci unsigned long tp_value; 1962306a36Sopenharmony_ci struct restart_block restart_block; 2062306a36Sopenharmony_ci struct pt_regs *regs; 2162306a36Sopenharmony_ci unsigned int cpu; 2262306a36Sopenharmony_ci}; 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define INIT_THREAD_INFO(tsk) \ 2562306a36Sopenharmony_ci{ \ 2662306a36Sopenharmony_ci .task = &tsk, \ 2762306a36Sopenharmony_ci .preempt_count = INIT_PREEMPT_COUNT, \ 2862306a36Sopenharmony_ci .cpu = 0, \ 2962306a36Sopenharmony_ci .restart_block = { \ 3062306a36Sopenharmony_ci .fn = do_no_restart_syscall, \ 3162306a36Sopenharmony_ci }, \ 3262306a36Sopenharmony_ci} 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci#define thread_saved_fp(tsk) \ 3762306a36Sopenharmony_ci ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r8)) 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci#define thread_saved_sp(tsk) \ 4062306a36Sopenharmony_ci ((unsigned long)(tsk->thread.sp)) 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define thread_saved_lr(tsk) \ 4362306a36Sopenharmony_ci ((unsigned long)(((struct switch_stack *)(tsk->thread.sp))->r15)) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_cistatic inline struct thread_info *current_thread_info(void) 4662306a36Sopenharmony_ci{ 4762306a36Sopenharmony_ci unsigned long sp; 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci asm volatile("mov %0, sp\n":"=r"(sp)); 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); 5262306a36Sopenharmony_ci} 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define TIF_SIGPENDING 0 /* signal pending */ 5762306a36Sopenharmony_ci#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ 5862306a36Sopenharmony_ci#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 5962306a36Sopenharmony_ci#define TIF_UPROBE 3 /* uprobe breakpoint or singlestep */ 6062306a36Sopenharmony_ci#define TIF_SYSCALL_TRACE 4 /* syscall trace active */ 6162306a36Sopenharmony_ci#define TIF_SYSCALL_TRACEPOINT 5 /* syscall tracepoint instrumentation */ 6262306a36Sopenharmony_ci#define TIF_SYSCALL_AUDIT 6 /* syscall auditing */ 6362306a36Sopenharmony_ci#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ 6462306a36Sopenharmony_ci#define TIF_POLLING_NRFLAG 16 /* poll_idle() is TIF_NEED_RESCHED */ 6562306a36Sopenharmony_ci#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 6662306a36Sopenharmony_ci#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ 6762306a36Sopenharmony_ci#define TIF_SECCOMP 21 /* secure computing */ 6862306a36Sopenharmony_ci 6962306a36Sopenharmony_ci#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 7062306a36Sopenharmony_ci#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 7162306a36Sopenharmony_ci#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 7262306a36Sopenharmony_ci#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 7362306a36Sopenharmony_ci#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 7462306a36Sopenharmony_ci#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 7562306a36Sopenharmony_ci#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 7662306a36Sopenharmony_ci#define _TIF_UPROBE (1 << TIF_UPROBE) 7762306a36Sopenharmony_ci#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 7862306a36Sopenharmony_ci#define _TIF_MEMDIE (1 << TIF_MEMDIE) 7962306a36Sopenharmony_ci#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 8062306a36Sopenharmony_ci#define _TIF_SECCOMP (1 << TIF_SECCOMP) 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ 8362306a36Sopenharmony_ci _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ 8462306a36Sopenharmony_ci _TIF_NOTIFY_SIGNAL) 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 8762306a36Sopenharmony_ci _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP) 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci#endif /* _ASM_CSKY_THREAD_INFO_H */ 90