Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
0004  */
0005 
0006 #ifndef __UM_THREAD_INFO_H
0007 #define __UM_THREAD_INFO_H
0008 
0009 #define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
0010 #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
0011 
0012 #ifndef __ASSEMBLY__
0013 
0014 #include <asm/types.h>
0015 #include <asm/page.h>
0016 #include <asm/segment.h>
0017 #include <sysdep/ptrace_user.h>
0018 
0019 struct thread_info {
0020     struct task_struct  *task;      /* main task structure */
0021     unsigned long       flags;      /* low level flags */
0022     __u32           cpu;        /* current CPU */
0023     int         preempt_count;  /* 0 => preemptable,
0024                            <0 => BUG */
0025     struct thread_info  *real_thread;    /* Points to non-IRQ stack */
0026     unsigned long aux_fp_regs[FP_SIZE]; /* auxiliary fp_regs to save/restore
0027                            them out-of-band */
0028 };
0029 
0030 #define INIT_THREAD_INFO(tsk)           \
0031 {                       \
0032     .task =     &tsk,           \
0033     .flags =        0,      \
0034     .cpu =      0,          \
0035     .preempt_count = INIT_PREEMPT_COUNT,    \
0036     .real_thread = NULL,            \
0037 }
0038 
0039 /* how to get the thread information struct from C */
0040 static inline struct thread_info *current_thread_info(void)
0041 {
0042     struct thread_info *ti;
0043     unsigned long mask = THREAD_SIZE - 1;
0044     void *p;
0045 
0046     asm volatile ("" : "=r" (p) : "0" (&ti));
0047     ti = (struct thread_info *) (((unsigned long)p) & ~mask);
0048     return ti;
0049 }
0050 
0051 #endif
0052 
0053 #define TIF_SYSCALL_TRACE   0   /* syscall trace active */
0054 #define TIF_SIGPENDING      1   /* signal pending */
0055 #define TIF_NEED_RESCHED    2   /* rescheduling necessary */
0056 #define TIF_NOTIFY_SIGNAL   3   /* signal notifications exist */
0057 #define TIF_RESTART_BLOCK   4
0058 #define TIF_MEMDIE      5   /* is terminating due to OOM killer */
0059 #define TIF_SYSCALL_AUDIT   6
0060 #define TIF_RESTORE_SIGMASK 7
0061 #define TIF_NOTIFY_RESUME   8
0062 #define TIF_SECCOMP     9   /* secure computing */
0063 #define TIF_SINGLESTEP      10  /* single stepping userspace */
0064 
0065 #define _TIF_SYSCALL_TRACE  (1 << TIF_SYSCALL_TRACE)
0066 #define _TIF_SIGPENDING     (1 << TIF_SIGPENDING)
0067 #define _TIF_NEED_RESCHED   (1 << TIF_NEED_RESCHED)
0068 #define _TIF_NOTIFY_SIGNAL  (1 << TIF_NOTIFY_SIGNAL)
0069 #define _TIF_MEMDIE     (1 << TIF_MEMDIE)
0070 #define _TIF_SYSCALL_AUDIT  (1 << TIF_SYSCALL_AUDIT)
0071 #define _TIF_SECCOMP        (1 << TIF_SECCOMP)
0072 #define _TIF_SINGLESTEP     (1 << TIF_SINGLESTEP)
0073 
0074 #endif