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

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

Version: ~ [ linux-5.9 ] ~ [ linux-5.8.14 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.70 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.150 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.200 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.238 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.238 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _ASM_M32R_THREAD_INFO_H
  2 #define _ASM_M32R_THREAD_INFO_H
  3 
  4 /* thread_info.h: m32r low-level thread information
  5  *
  6  * Copyright (C) 2002  David Howells (dhowells@redhat.com)
  7  * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  8  * Copyright (C) 2004  Hirokazu Takata <takata at linux-m32r.org>
  9  */
 10 
 11 #ifdef __KERNEL__
 12 
 13 #ifndef __ASSEMBLY__
 14 #include <asm/processor.h>
 15 #endif
 16 
 17 /*
 18  * low level task data that entry.S needs immediate access to
 19  * - this struct should fit entirely inside of one cache line
 20  * - this struct shares the supervisor stack pages
 21  * - if the contents of this structure are changed, the assembly constants must also be changed
 22  */
 23 #ifndef __ASSEMBLY__
 24 
 25 struct thread_info {
 26         struct task_struct      *task;          /* main task structure */
 27         struct exec_domain      *exec_domain;   /* execution domain */
 28         unsigned long           flags;          /* low level flags */
 29         unsigned long           status;         /* thread-synchronous flags */
 30         __u32                   cpu;            /* current CPU */
 31         int                     preempt_count;  /* 0 => preemptable, <0 => BUG */
 32 
 33         mm_segment_t            addr_limit;     /* thread address space:
 34                                                    0-0xBFFFFFFF for user-thread
 35                                                    0-0xFFFFFFFF for kernel-thread
 36                                                 */
 37         struct restart_block    restart_block;
 38 
 39         __u8                    supervisor_stack[0];
 40 };
 41 
 42 #else /* !__ASSEMBLY__ */
 43 
 44 /* offsets into the thread_info struct for assembly code access */
 45 #define TI_TASK         0x00000000
 46 #define TI_EXEC_DOMAIN  0x00000004
 47 #define TI_FLAGS        0x00000008
 48 #define TI_STATUS       0x0000000C
 49 #define TI_CPU          0x00000010
 50 #define TI_PRE_COUNT    0x00000014
 51 #define TI_ADDR_LIMIT   0x00000018
 52 #define TI_RESTART_BLOCK 0x000001C
 53 
 54 #endif
 55 
 56 #define PREEMPT_ACTIVE          0x10000000
 57 
 58 #define THREAD_SIZE             (PAGE_SIZE << 1)
 59 #define THREAD_SIZE_ORDER       1
 60 /*
 61  * macros/functions for gaining access to the thread information structure
 62  */
 63 #ifndef __ASSEMBLY__
 64 
 65 #define INIT_THREAD_INFO(tsk)                   \
 66 {                                               \
 67         .task           = &tsk,                 \
 68         .exec_domain    = &default_exec_domain, \
 69         .flags          = 0,                    \
 70         .cpu            = 0,                    \
 71         .preempt_count  = INIT_PREEMPT_COUNT,   \
 72         .addr_limit     = KERNEL_DS,            \
 73         .restart_block = {                      \
 74                 .fn = do_no_restart_syscall,    \
 75         },                                      \
 76 }
 77 
 78 #define init_thread_info        (init_thread_union.thread_info)
 79 #define init_stack              (init_thread_union.stack)
 80 
 81 /* how to get the thread information struct from C */
 82 static inline struct thread_info *current_thread_info(void)
 83 {
 84         struct thread_info *ti;
 85 
 86         __asm__ __volatile__ (
 87                 "ldi    %0, #%1                 \n\t"
 88                 "and    %0, sp                  \n\t"
 89                 : "=r" (ti) : "i" (~(THREAD_SIZE - 1))
 90         );
 91 
 92         return ti;
 93 }
 94 
 95 #define TI_FLAG_FAULT_CODE_SHIFT        28
 96 
 97 static inline void set_thread_fault_code(unsigned int val)
 98 {
 99         struct thread_info *ti = current_thread_info();
100         ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT)))
101                 | (val << TI_FLAG_FAULT_CODE_SHIFT);
102 }
103 
104 static inline unsigned int get_thread_fault_code(void)
105 {
106         struct thread_info *ti = current_thread_info();
107         return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT;
108 }
109 
110 #endif
111 
112 /*
113  * thread information flags
114  * - these are process state flags that various assembly files may need to access
115  * - pending work-to-be-done flags are in LSW
116  * - other flags in MSW
117  */
118 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
119 #define TIF_SIGPENDING          1       /* signal pending */
120 #define TIF_NEED_RESCHED        2       /* rescheduling necessary */
121 #define TIF_SINGLESTEP          3       /* restore singlestep on return to user mode */
122 #define TIF_NOTIFY_RESUME       5       /* callback before returning to user */
123 #define TIF_RESTORE_SIGMASK     8       /* restore signal mask in do_signal() */
124 #define TIF_USEDFPU             16      /* FPU was used by this task this quantum (SMP) */
125 #define TIF_MEMDIE              18      /* is terminating due to OOM killer */
126 
127 #define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
128 #define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
129 #define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
130 #define _TIF_SINGLESTEP         (1<<TIF_SINGLESTEP)
131 #define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
132 #define _TIF_USEDFPU            (1<<TIF_USEDFPU)
133 
134 #define _TIF_WORK_MASK          (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
135 #define _TIF_ALLWORK_MASK       (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
136 
137 /*
138  * Thread-synchronous status.
139  *
140  * This is different from the flags in that nobody else
141  * ever touches our thread-synchronous status, so we don't
142  * have to worry about atomic accesses.
143  */
144 #define TS_USEDFPU              0x0001  /* FPU was used by this task this quantum (SMP) */
145 
146 #endif /* __KERNEL__ */
147 
148 #endif /* _ASM_M32R_THREAD_INFO_H */
149 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp