~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/include/asm/thread_info.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2009 Chen Liqin <liqin.chen@sunplusct.com>
  4  * Copyright (C) 2012 Regents of the University of California
  5  * Copyright (C) 2017 SiFive
  6  */
  7 
  8 #ifndef _ASM_RISCV_THREAD_INFO_H
  9 #define _ASM_RISCV_THREAD_INFO_H
 10 
 11 #include <asm/page.h>
 12 #include <linux/const.h>
 13 #include <linux/sizes.h>
 14 
 15 /* thread information allocation */
 16 #ifdef CONFIG_KASAN
 17 #define KASAN_STACK_ORDER       1
 18 #else
 19 #define KASAN_STACK_ORDER       0
 20 #endif
 21 #define THREAD_SIZE_ORDER       (CONFIG_THREAD_SIZE_ORDER + KASAN_STACK_ORDER)
 22 #define THREAD_SIZE             (PAGE_SIZE << THREAD_SIZE_ORDER)
 23 
 24 /*
 25  * By aligning VMAP'd stacks to 2 * THREAD_SIZE, we can detect overflow by
 26  * checking sp & (1 << THREAD_SHIFT), which we can do cheaply in the entry
 27  * assembly.
 28  */
 29 #ifdef CONFIG_VMAP_STACK
 30 #define THREAD_ALIGN            (2 * THREAD_SIZE)
 31 #else
 32 #define THREAD_ALIGN            THREAD_SIZE
 33 #endif
 34 
 35 #define THREAD_SHIFT            (PAGE_SHIFT + THREAD_SIZE_ORDER)
 36 #define OVERFLOW_STACK_SIZE     SZ_4K
 37 
 38 #define IRQ_STACK_SIZE          THREAD_SIZE
 39 
 40 #ifndef __ASSEMBLY__
 41 
 42 #include <asm/processor.h>
 43 #include <asm/csr.h>
 44 
 45 /*
 46  * low level task data that entry.S needs immediate access to
 47  * - this struct should fit entirely inside of one cache line
 48  * - if the members of this struct changes, the assembly constants
 49  *   in asm-offsets.c must be updated accordingly
 50  * - thread_info is included in task_struct at an offset of 0.  This means that
 51  *   tp points to both thread_info and task_struct.
 52  */
 53 struct thread_info {
 54         unsigned long           flags;          /* low level flags */
 55         int                     preempt_count;  /* 0=>preemptible, <0=>BUG */
 56         /*
 57          * These stack pointers are overwritten on every system call or
 58          * exception.  SP is also saved to the stack it can be recovered when
 59          * overwritten.
 60          */
 61         long                    kernel_sp;      /* Kernel stack pointer */
 62         long                    user_sp;        /* User stack pointer */
 63         int                     cpu;
 64         unsigned long           syscall_work;   /* SYSCALL_WORK_ flags */
 65 #ifdef CONFIG_SHADOW_CALL_STACK
 66         void                    *scs_base;
 67         void                    *scs_sp;
 68 #endif
 69 };
 70 
 71 #ifdef CONFIG_SHADOW_CALL_STACK
 72 #define INIT_SCS                                                        \
 73         .scs_base       = init_shadow_call_stack,                       \
 74         .scs_sp         = init_shadow_call_stack,
 75 #else
 76 #define INIT_SCS
 77 #endif
 78 
 79 /*
 80  * macros/functions for gaining access to the thread information structure
 81  *
 82  * preempt_count needs to be 1 initially, until the scheduler is functional.
 83  */
 84 #define INIT_THREAD_INFO(tsk)                   \
 85 {                                               \
 86         .flags          = 0,                    \
 87         .preempt_count  = INIT_PREEMPT_COUNT,   \
 88         INIT_SCS                                \
 89 }
 90 
 91 void arch_release_task_struct(struct task_struct *tsk);
 92 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
 93 
 94 #endif /* !__ASSEMBLY__ */
 95 
 96 /*
 97  * thread information flags
 98  * - these are process state flags that various assembly files may need to
 99  *   access
100  * - pending work-to-be-done flags are in lowest half-word
101  * - other flags in upper half-word(s)
102  */
103 #define TIF_NOTIFY_RESUME       1       /* callback before returning to user */
104 #define TIF_SIGPENDING          2       /* signal pending */
105 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
106 #define TIF_RESTORE_SIGMASK     4       /* restore signal mask in do_signal() */
107 #define TIF_MEMDIE              5       /* is terminating due to OOM killer */
108 #define TIF_NOTIFY_SIGNAL       9       /* signal notifications exist */
109 #define TIF_UPROBE              10      /* uprobe breakpoint or singlestep */
110 #define TIF_32BIT               11      /* compat-mode 32bit process */
111 #define TIF_RISCV_V_DEFER_RESTORE       12 /* restore Vector before returing to user */
112 
113 #define _TIF_NOTIFY_RESUME      (1 << TIF_NOTIFY_RESUME)
114 #define _TIF_SIGPENDING         (1 << TIF_SIGPENDING)
115 #define _TIF_NEED_RESCHED       (1 << TIF_NEED_RESCHED)
116 #define _TIF_NOTIFY_SIGNAL      (1 << TIF_NOTIFY_SIGNAL)
117 #define _TIF_UPROBE             (1 << TIF_UPROBE)
118 #define _TIF_RISCV_V_DEFER_RESTORE      (1 << TIF_RISCV_V_DEFER_RESTORE)
119 
120 #define _TIF_WORK_MASK \
121         (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | \
122          _TIF_NOTIFY_SIGNAL | _TIF_UPROBE)
123 
124 #endif /* _ASM_RISCV_THREAD_INFO_H */
125 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php