18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Based on arch/arm/include/asm/thread_info.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2002 Russell King. 68c2ecf20Sopenharmony_ci * Copyright (C) 2012 ARM Ltd. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef __ASM_THREAD_INFO_H 98c2ecf20Sopenharmony_ci#define __ASM_THREAD_INFO_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/compiler.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct task_struct; 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include <asm/memory.h> 188c2ecf20Sopenharmony_ci#include <asm/stack_pointer.h> 198c2ecf20Sopenharmony_ci#include <asm/types.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_citypedef unsigned long mm_segment_t; 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* 248c2ecf20Sopenharmony_ci * low level task data that entry.S needs immediate access to. 258c2ecf20Sopenharmony_ci */ 268c2ecf20Sopenharmony_cistruct thread_info { 278c2ecf20Sopenharmony_ci unsigned long flags; /* low level flags */ 288c2ecf20Sopenharmony_ci mm_segment_t addr_limit; /* address limit */ 298c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM64_SW_TTBR0_PAN 308c2ecf20Sopenharmony_ci u64 ttbr0; /* saved TTBR0_EL1 */ 318c2ecf20Sopenharmony_ci#endif 328c2ecf20Sopenharmony_ci union { 338c2ecf20Sopenharmony_ci u64 preempt_count; /* 0 => preemptible, <0 => bug */ 348c2ecf20Sopenharmony_ci struct { 358c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_BIG_ENDIAN 368c2ecf20Sopenharmony_ci u32 need_resched; 378c2ecf20Sopenharmony_ci u32 count; 388c2ecf20Sopenharmony_ci#else 398c2ecf20Sopenharmony_ci u32 count; 408c2ecf20Sopenharmony_ci u32 need_resched; 418c2ecf20Sopenharmony_ci#endif 428c2ecf20Sopenharmony_ci } preempt; 438c2ecf20Sopenharmony_ci }; 448c2ecf20Sopenharmony_ci#ifdef CONFIG_SHADOW_CALL_STACK 458c2ecf20Sopenharmony_ci void *scs_base; 468c2ecf20Sopenharmony_ci void *scs_sp; 478c2ecf20Sopenharmony_ci#endif 488c2ecf20Sopenharmony_ci}; 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#define thread_saved_pc(tsk) \ 518c2ecf20Sopenharmony_ci ((unsigned long)(tsk->thread.cpu_context.pc)) 528c2ecf20Sopenharmony_ci#define thread_saved_sp(tsk) \ 538c2ecf20Sopenharmony_ci ((unsigned long)(tsk->thread.cpu_context.sp)) 548c2ecf20Sopenharmony_ci#define thread_saved_fp(tsk) \ 558c2ecf20Sopenharmony_ci ((unsigned long)(tsk->thread.cpu_context.fp)) 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_civoid arch_setup_new_exec(void); 588c2ecf20Sopenharmony_ci#define arch_setup_new_exec arch_setup_new_exec 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_civoid arch_release_task_struct(struct task_struct *tsk); 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#endif 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define TIF_SIGPENDING 0 /* signal pending */ 658c2ecf20Sopenharmony_ci#define TIF_NEED_RESCHED 1 /* rescheduling necessary */ 668c2ecf20Sopenharmony_ci#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 678c2ecf20Sopenharmony_ci#define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */ 688c2ecf20Sopenharmony_ci#define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */ 698c2ecf20Sopenharmony_ci#define TIF_FSCHECK 5 /* Check FS is USER_DS on return */ 708c2ecf20Sopenharmony_ci#define TIF_MTE_ASYNC_FAULT 6 /* MTE Asynchronous Tag Check Fault */ 718c2ecf20Sopenharmony_ci#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ 728c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACE 8 /* syscall trace active */ 738c2ecf20Sopenharmony_ci#define TIF_SYSCALL_AUDIT 9 /* syscall auditing */ 748c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */ 758c2ecf20Sopenharmony_ci#define TIF_SECCOMP 11 /* syscall secure computing */ 768c2ecf20Sopenharmony_ci#define TIF_SYSCALL_EMU 12 /* syscall emulation active */ 778c2ecf20Sopenharmony_ci#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 788c2ecf20Sopenharmony_ci#define TIF_FREEZE 19 798c2ecf20Sopenharmony_ci#define TIF_RESTORE_SIGMASK 20 808c2ecf20Sopenharmony_ci#define TIF_SINGLESTEP 21 818c2ecf20Sopenharmony_ci#define TIF_32BIT 22 /* 32bit process */ 828c2ecf20Sopenharmony_ci#define TIF_SVE 23 /* Scalable Vector Extension in use */ 838c2ecf20Sopenharmony_ci#define TIF_SVE_VL_INHERIT 24 /* Inherit sve_vl_onexec across exec */ 848c2ecf20Sopenharmony_ci#define TIF_SSBD 25 /* Wants SSB mitigation */ 858c2ecf20Sopenharmony_ci#define TIF_TAGGED_ADDR 26 /* Allow tagged user addresses */ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 888c2ecf20Sopenharmony_ci#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 898c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 908c2ecf20Sopenharmony_ci#define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE) 918c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 928c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 938c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 948c2ecf20Sopenharmony_ci#define _TIF_SECCOMP (1 << TIF_SECCOMP) 958c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU) 968c2ecf20Sopenharmony_ci#define _TIF_UPROBE (1 << TIF_UPROBE) 978c2ecf20Sopenharmony_ci#define _TIF_FSCHECK (1 << TIF_FSCHECK) 988c2ecf20Sopenharmony_ci#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 998c2ecf20Sopenharmony_ci#define _TIF_32BIT (1 << TIF_32BIT) 1008c2ecf20Sopenharmony_ci#define _TIF_SVE (1 << TIF_SVE) 1018c2ecf20Sopenharmony_ci#define _TIF_MTE_ASYNC_FAULT (1 << TIF_MTE_ASYNC_FAULT) 1028c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ 1058c2ecf20Sopenharmony_ci _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \ 1068c2ecf20Sopenharmony_ci _TIF_UPROBE | _TIF_FSCHECK | _TIF_MTE_ASYNC_FAULT | \ 1078c2ecf20Sopenharmony_ci _TIF_NOTIFY_SIGNAL) 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \ 1108c2ecf20Sopenharmony_ci _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \ 1118c2ecf20Sopenharmony_ci _TIF_SYSCALL_EMU) 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#ifdef CONFIG_SHADOW_CALL_STACK 1148c2ecf20Sopenharmony_ci#define INIT_SCS \ 1158c2ecf20Sopenharmony_ci .scs_base = init_shadow_call_stack, \ 1168c2ecf20Sopenharmony_ci .scs_sp = init_shadow_call_stack, 1178c2ecf20Sopenharmony_ci#else 1188c2ecf20Sopenharmony_ci#define INIT_SCS 1198c2ecf20Sopenharmony_ci#endif 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define INIT_THREAD_INFO(tsk) \ 1228c2ecf20Sopenharmony_ci{ \ 1238c2ecf20Sopenharmony_ci .flags = _TIF_FOREIGN_FPSTATE, \ 1248c2ecf20Sopenharmony_ci .preempt_count = INIT_PREEMPT_COUNT, \ 1258c2ecf20Sopenharmony_ci .addr_limit = KERNEL_DS, \ 1268c2ecf20Sopenharmony_ci INIT_SCS \ 1278c2ecf20Sopenharmony_ci} 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci#endif /* __ASM_THREAD_INFO_H */ 130