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

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

Version: ~ [ linux-5.2-rc1 ] ~ [ linux-5.1.2 ] ~ [ linux-5.0.16 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.43 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.119 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.176 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.179 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.139 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.67 ] ~ [ 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-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ 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 /* MN10300 Low-level thread information
  2  *
  3  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4  * Written by David Howells (dhowells@redhat.com)
  5  *
  6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU General Public Licence
  8  * as published by the Free Software Foundation; either version
  9  * 2 of the Licence, or (at your option) any later version.
 10  */
 11 
 12 #ifndef _ASM_THREAD_INFO_H
 13 #define _ASM_THREAD_INFO_H
 14 
 15 #ifdef __KERNEL__
 16 
 17 #include <asm/page.h>
 18 
 19 #ifdef CONFIG_4KSTACKS
 20 #define THREAD_SIZE             (4096)
 21 #define THREAD_SIZE_ORDER       (0)
 22 #else
 23 #define THREAD_SIZE             (8192)
 24 #define THREAD_SIZE_ORDER       (1)
 25 #endif
 26 
 27 #define STACK_WARN              (THREAD_SIZE / 8)
 28 
 29 /*
 30  * low level task data that entry.S needs immediate access to
 31  * - this struct should fit entirely inside of one cache line
 32  * - this struct shares the supervisor stack pages
 33  * - if the contents of this structure are changed, the assembly constants
 34  *   must also be changed
 35  */
 36 #ifndef __ASSEMBLY__
 37 typedef struct {
 38         unsigned long   seg;
 39 } mm_segment_t;
 40 
 41 struct thread_info {
 42         struct task_struct      *task;          /* main task structure */
 43         struct pt_regs          *frame;         /* current exception frame */
 44         unsigned long           flags;          /* low level flags */
 45         __u32                   cpu;            /* current CPU */
 46         __s32                   preempt_count;  /* 0 => preemptable, <0 => BUG */
 47 
 48         mm_segment_t            addr_limit;     /* thread address space:
 49                                                    0-0xBFFFFFFF for user-thead
 50                                                    0-0xFFFFFFFF for kernel-thread
 51                                                 */
 52 
 53         __u8                    supervisor_stack[0];
 54 };
 55 
 56 #define thread_info_to_uregs(ti)                                        \
 57         ((struct pt_regs *)                                             \
 58          ((unsigned long)ti + THREAD_SIZE - sizeof(struct pt_regs)))
 59 
 60 #else /* !__ASSEMBLY__ */
 61 
 62 #ifndef __ASM_OFFSETS_H__
 63 #include <asm/asm-offsets.h>
 64 #endif
 65 
 66 #endif
 67 
 68 /*
 69  * macros/functions for gaining access to the thread information structure
 70  */
 71 #ifndef __ASSEMBLY__
 72 
 73 #define INIT_THREAD_INFO(tsk)                   \
 74 {                                               \
 75         .task           = &tsk,                 \
 76         .flags          = 0,                    \
 77         .cpu            = 0,                    \
 78         .preempt_count  = INIT_PREEMPT_COUNT,   \
 79         .addr_limit     = KERNEL_DS,            \
 80 }
 81 
 82 #define init_uregs                                                      \
 83         ((struct pt_regs *)                                             \
 84          ((unsigned long) init_stack + THREAD_SIZE - sizeof(struct pt_regs)))
 85 
 86 extern struct thread_info *__current_ti;
 87 
 88 /* how to get the thread information struct from C */
 89 static inline __attribute__((const))
 90 struct thread_info *current_thread_info(void)
 91 {
 92         struct thread_info *ti;
 93         asm("mov sp,%0\n"
 94             "and %1,%0\n"
 95             : "=d" (ti)
 96             : "i" (~(THREAD_SIZE - 1))
 97             : "cc");
 98         return ti;
 99 }
100 
101 static inline __attribute__((const))
102 struct pt_regs *current_frame(void)
103 {
104         return current_thread_info()->frame;
105 }
106 
107 /* how to get the current stack pointer from C */
108 static inline unsigned long current_stack_pointer(void)
109 {
110         unsigned long sp;
111         asm("mov sp,%0; ":"=r" (sp));
112         return sp;
113 }
114 
115 #ifndef CONFIG_KGDB
116 void arch_release_thread_stack(unsigned long *stack);
117 #endif
118 #define get_thread_info(ti)     get_task_struct((ti)->task)
119 #define put_thread_info(ti)     put_task_struct((ti)->task)
120 
121 #else /* !__ASSEMBLY__ */
122 
123 #ifndef __VMLINUX_LDS__
124 /* how to get the thread information struct from ASM */
125 .macro GET_THREAD_INFO reg
126         mov     sp,\reg
127         and     -THREAD_SIZE,\reg
128 .endm
129 #endif
130 #endif
131 
132 /*
133  * thread information flags
134  * - these are process state flags that various assembly files may need to
135  *   access
136  * - pending work-to-be-done flags are in LSW
137  * - other flags in MSW
138  */
139 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
140 #define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
141 #define TIF_SIGPENDING          2       /* signal pending */
142 #define TIF_NEED_RESCHED        3       /* rescheduling necessary */
143 #define TIF_SINGLESTEP          4       /* restore singlestep on return to user mode */
144 #define TIF_RESTORE_SIGMASK     5       /* restore signal mask in do_signal() */
145 #define TIF_POLLING_NRFLAG      16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
146 #define TIF_MEMDIE              17      /* is terminating due to OOM killer */
147 
148 #define _TIF_SYSCALL_TRACE      +(1 << TIF_SYSCALL_TRACE)
149 #define _TIF_NOTIFY_RESUME      +(1 << TIF_NOTIFY_RESUME)
150 #define _TIF_SIGPENDING         +(1 << TIF_SIGPENDING)
151 #define _TIF_NEED_RESCHED       +(1 << TIF_NEED_RESCHED)
152 #define _TIF_SINGLESTEP         +(1 << TIF_SINGLESTEP)
153 #define _TIF_POLLING_NRFLAG     +(1 << TIF_POLLING_NRFLAG)
154 
155 #define _TIF_WORK_MASK          0x0000FFFE      /* work to do on interrupt/exception return */
156 #define _TIF_ALLWORK_MASK       0x0000FFFF      /* work to do on any return to u-space */
157 
158 #endif /* __KERNEL__ */
159 
160 #endif /* _ASM_THREAD_INFO_H */
161 

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