Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Based on arch/arm/include/asm/thread_info.h
0004  *
0005  * Copyright (C) 2002 Russell King.
0006  * Copyright (C) 2012 ARM Ltd.
0007  */
0008 #ifndef __ASM_THREAD_INFO_H
0009 #define __ASM_THREAD_INFO_H
0010 
0011 #include <linux/compiler.h>
0012 
0013 #ifndef __ASSEMBLY__
0014 
0015 struct task_struct;
0016 
0017 #include <asm/memory.h>
0018 #include <asm/stack_pointer.h>
0019 #include <asm/types.h>
0020 
0021 /*
0022  * low level task data that entry.S needs immediate access to.
0023  */
0024 struct thread_info {
0025     unsigned long       flags;      /* low level flags */
0026 #ifdef CONFIG_ARM64_SW_TTBR0_PAN
0027     u64         ttbr0;      /* saved TTBR0_EL1 */
0028 #endif
0029     union {
0030         u64     preempt_count;  /* 0 => preemptible, <0 => bug */
0031         struct {
0032 #ifdef CONFIG_CPU_BIG_ENDIAN
0033             u32 need_resched;
0034             u32 count;
0035 #else
0036             u32 count;
0037             u32 need_resched;
0038 #endif
0039         } preempt;
0040     };
0041 #ifdef CONFIG_SHADOW_CALL_STACK
0042     void            *scs_base;
0043     void            *scs_sp;
0044 #endif
0045     u32         cpu;
0046 };
0047 
0048 #define thread_saved_pc(tsk)    \
0049     ((unsigned long)(tsk->thread.cpu_context.pc))
0050 #define thread_saved_sp(tsk)    \
0051     ((unsigned long)(tsk->thread.cpu_context.sp))
0052 #define thread_saved_fp(tsk)    \
0053     ((unsigned long)(tsk->thread.cpu_context.fp))
0054 
0055 void arch_setup_new_exec(void);
0056 #define arch_setup_new_exec     arch_setup_new_exec
0057 
0058 void arch_release_task_struct(struct task_struct *tsk);
0059 int arch_dup_task_struct(struct task_struct *dst,
0060                 struct task_struct *src);
0061 
0062 #endif
0063 
0064 #define TIF_SIGPENDING      0   /* signal pending */
0065 #define TIF_NEED_RESCHED    1   /* rescheduling necessary */
0066 #define TIF_NOTIFY_RESUME   2   /* callback before returning to user */
0067 #define TIF_FOREIGN_FPSTATE 3   /* CPU's FP state is not current's */
0068 #define TIF_UPROBE      4   /* uprobe breakpoint or singlestep */
0069 #define TIF_MTE_ASYNC_FAULT 5   /* MTE Asynchronous Tag Check Fault */
0070 #define TIF_NOTIFY_SIGNAL   6   /* signal notifications exist */
0071 #define TIF_SYSCALL_TRACE   8   /* syscall trace active */
0072 #define TIF_SYSCALL_AUDIT   9   /* syscall auditing */
0073 #define TIF_SYSCALL_TRACEPOINT  10  /* syscall tracepoint for ftrace */
0074 #define TIF_SECCOMP     11  /* syscall secure computing */
0075 #define TIF_SYSCALL_EMU     12  /* syscall emulation active */
0076 #define TIF_MEMDIE      18  /* is terminating due to OOM killer */
0077 #define TIF_FREEZE      19
0078 #define TIF_RESTORE_SIGMASK 20
0079 #define TIF_SINGLESTEP      21
0080 #define TIF_32BIT       22  /* 32bit process */
0081 #define TIF_SVE         23  /* Scalable Vector Extension in use */
0082 #define TIF_SVE_VL_INHERIT  24  /* Inherit SVE vl_onexec across exec */
0083 #define TIF_SSBD        25  /* Wants SSB mitigation */
0084 #define TIF_TAGGED_ADDR     26  /* Allow tagged user addresses */
0085 #define TIF_SME         27  /* SME in use */
0086 #define TIF_SME_VL_INHERIT  28  /* Inherit SME vl_onexec across exec */
0087 
0088 #define _TIF_SIGPENDING     (1 << TIF_SIGPENDING)
0089 #define _TIF_NEED_RESCHED   (1 << TIF_NEED_RESCHED)
0090 #define _TIF_NOTIFY_RESUME  (1 << TIF_NOTIFY_RESUME)
0091 #define _TIF_FOREIGN_FPSTATE    (1 << TIF_FOREIGN_FPSTATE)
0092 #define _TIF_SYSCALL_TRACE  (1 << TIF_SYSCALL_TRACE)
0093 #define _TIF_SYSCALL_AUDIT  (1 << TIF_SYSCALL_AUDIT)
0094 #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
0095 #define _TIF_SECCOMP        (1 << TIF_SECCOMP)
0096 #define _TIF_SYSCALL_EMU    (1 << TIF_SYSCALL_EMU)
0097 #define _TIF_UPROBE     (1 << TIF_UPROBE)
0098 #define _TIF_SINGLESTEP     (1 << TIF_SINGLESTEP)
0099 #define _TIF_32BIT      (1 << TIF_32BIT)
0100 #define _TIF_SVE        (1 << TIF_SVE)
0101 #define _TIF_MTE_ASYNC_FAULT    (1 << TIF_MTE_ASYNC_FAULT)
0102 #define _TIF_NOTIFY_SIGNAL  (1 << TIF_NOTIFY_SIGNAL)
0103 
0104 #define _TIF_WORK_MASK      (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
0105                  _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
0106                  _TIF_UPROBE | _TIF_MTE_ASYNC_FAULT | \
0107                  _TIF_NOTIFY_SIGNAL)
0108 
0109 #define _TIF_SYSCALL_WORK   (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
0110                  _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
0111                  _TIF_SYSCALL_EMU)
0112 
0113 #ifdef CONFIG_SHADOW_CALL_STACK
0114 #define INIT_SCS                            \
0115     .scs_base   = init_shadow_call_stack,           \
0116     .scs_sp     = init_shadow_call_stack,
0117 #else
0118 #define INIT_SCS
0119 #endif
0120 
0121 #define INIT_THREAD_INFO(tsk)                       \
0122 {                                   \
0123     .flags      = _TIF_FOREIGN_FPSTATE,             \
0124     .preempt_count  = INIT_PREEMPT_COUNT,               \
0125     INIT_SCS                            \
0126 }
0127 
0128 #endif /* __ASM_THREAD_INFO_H */