162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Based on arch/arm/include/asm/thread_info.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2002 Russell King. 662306a36Sopenharmony_ci * Copyright (C) 2012 ARM Ltd. 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci#ifndef __ASM_THREAD_INFO_H 962306a36Sopenharmony_ci#define __ASM_THREAD_INFO_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/compiler.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cistruct task_struct; 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci#include <asm/memory.h> 1862306a36Sopenharmony_ci#include <asm/stack_pointer.h> 1962306a36Sopenharmony_ci#include <asm/types.h> 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/* 2262306a36Sopenharmony_ci * low level task data that entry.S needs immediate access to. 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_cistruct thread_info { 2562306a36Sopenharmony_ci unsigned long flags; /* low level flags */ 2662306a36Sopenharmony_ci#ifdef CONFIG_ARM64_SW_TTBR0_PAN 2762306a36Sopenharmony_ci u64 ttbr0; /* saved TTBR0_EL1 */ 2862306a36Sopenharmony_ci#endif 2962306a36Sopenharmony_ci union { 3062306a36Sopenharmony_ci u64 preempt_count; /* 0 => preemptible, <0 => bug */ 3162306a36Sopenharmony_ci struct { 3262306a36Sopenharmony_ci#ifdef CONFIG_CPU_BIG_ENDIAN 3362306a36Sopenharmony_ci u32 need_resched; 3462306a36Sopenharmony_ci u32 count; 3562306a36Sopenharmony_ci#else 3662306a36Sopenharmony_ci u32 count; 3762306a36Sopenharmony_ci u32 need_resched; 3862306a36Sopenharmony_ci#endif 3962306a36Sopenharmony_ci } preempt; 4062306a36Sopenharmony_ci }; 4162306a36Sopenharmony_ci#ifdef CONFIG_SHADOW_CALL_STACK 4262306a36Sopenharmony_ci void *scs_base; 4362306a36Sopenharmony_ci void *scs_sp; 4462306a36Sopenharmony_ci#endif 4562306a36Sopenharmony_ci u32 cpu; 4662306a36Sopenharmony_ci}; 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define thread_saved_pc(tsk) \ 4962306a36Sopenharmony_ci ((unsigned long)(tsk->thread.cpu_context.pc)) 5062306a36Sopenharmony_ci#define thread_saved_sp(tsk) \ 5162306a36Sopenharmony_ci ((unsigned long)(tsk->thread.cpu_context.sp)) 5262306a36Sopenharmony_ci#define thread_saved_fp(tsk) \ 5362306a36Sopenharmony_ci ((unsigned long)(tsk->thread.cpu_context.fp)) 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_civoid arch_setup_new_exec(void); 5662306a36Sopenharmony_ci#define arch_setup_new_exec arch_setup_new_exec 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#endif 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci#define TIF_SIGPENDING 0 /* signal pending */ 6162306a36Sopenharmony_ci#define TIF_NEED_RESCHED 1 /* rescheduling necessary */ 6262306a36Sopenharmony_ci#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 6362306a36Sopenharmony_ci#define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */ 6462306a36Sopenharmony_ci#define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */ 6562306a36Sopenharmony_ci#define TIF_MTE_ASYNC_FAULT 5 /* MTE Asynchronous Tag Check Fault */ 6662306a36Sopenharmony_ci#define TIF_NOTIFY_SIGNAL 6 /* signal notifications exist */ 6762306a36Sopenharmony_ci#define TIF_SYSCALL_TRACE 8 /* syscall trace active */ 6862306a36Sopenharmony_ci#define TIF_SYSCALL_AUDIT 9 /* syscall auditing */ 6962306a36Sopenharmony_ci#define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */ 7062306a36Sopenharmony_ci#define TIF_SECCOMP 11 /* syscall secure computing */ 7162306a36Sopenharmony_ci#define TIF_SYSCALL_EMU 12 /* syscall emulation active */ 7262306a36Sopenharmony_ci#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 7362306a36Sopenharmony_ci#define TIF_FREEZE 19 7462306a36Sopenharmony_ci#define TIF_RESTORE_SIGMASK 20 7562306a36Sopenharmony_ci#define TIF_SINGLESTEP 21 7662306a36Sopenharmony_ci#define TIF_32BIT 22 /* 32bit process */ 7762306a36Sopenharmony_ci#define TIF_SVE 23 /* Scalable Vector Extension in use */ 7862306a36Sopenharmony_ci#define TIF_SVE_VL_INHERIT 24 /* Inherit SVE vl_onexec across exec */ 7962306a36Sopenharmony_ci#define TIF_SSBD 25 /* Wants SSB mitigation */ 8062306a36Sopenharmony_ci#define TIF_TAGGED_ADDR 26 /* Allow tagged user addresses */ 8162306a36Sopenharmony_ci#define TIF_SME 27 /* SME in use */ 8262306a36Sopenharmony_ci#define TIF_SME_VL_INHERIT 28 /* Inherit SME vl_onexec across exec */ 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 8562306a36Sopenharmony_ci#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 8662306a36Sopenharmony_ci#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 8762306a36Sopenharmony_ci#define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE) 8862306a36Sopenharmony_ci#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 8962306a36Sopenharmony_ci#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 9062306a36Sopenharmony_ci#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 9162306a36Sopenharmony_ci#define _TIF_SECCOMP (1 << TIF_SECCOMP) 9262306a36Sopenharmony_ci#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) 9362306a36Sopenharmony_ci#define _TIF_UPROBE (1 << TIF_UPROBE) 9462306a36Sopenharmony_ci#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 9562306a36Sopenharmony_ci#define _TIF_32BIT (1 << TIF_32BIT) 9662306a36Sopenharmony_ci#define _TIF_SVE (1 << TIF_SVE) 9762306a36Sopenharmony_ci#define _TIF_MTE_ASYNC_FAULT (1 << TIF_MTE_ASYNC_FAULT) 9862306a36Sopenharmony_ci#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ 10162306a36Sopenharmony_ci _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \ 10262306a36Sopenharmony_ci _TIF_UPROBE | _TIF_MTE_ASYNC_FAULT | \ 10362306a36Sopenharmony_ci _TIF_NOTIFY_SIGNAL) 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 10662306a36Sopenharmony_ci _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ 10762306a36Sopenharmony_ci _TIF_SYSCALL_EMU) 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci#ifdef CONFIG_SHADOW_CALL_STACK 11062306a36Sopenharmony_ci#define INIT_SCS \ 11162306a36Sopenharmony_ci .scs_base = init_shadow_call_stack, \ 11262306a36Sopenharmony_ci .scs_sp = init_shadow_call_stack, 11362306a36Sopenharmony_ci#else 11462306a36Sopenharmony_ci#define INIT_SCS 11562306a36Sopenharmony_ci#endif 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define INIT_THREAD_INFO(tsk) \ 11862306a36Sopenharmony_ci{ \ 11962306a36Sopenharmony_ci .flags = _TIF_FOREIGN_FPSTATE, \ 12062306a36Sopenharmony_ci .preempt_count = INIT_PREEMPT_COUNT, \ 12162306a36Sopenharmony_ci INIT_SCS \ 12262306a36Sopenharmony_ci} 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci#endif /* __ASM_THREAD_INFO_H */ 125