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

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

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

~ [ 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