Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ALPHA_THREAD_INFO_H
0003 #define _ALPHA_THREAD_INFO_H
0004 
0005 #ifdef __KERNEL__
0006 
0007 #ifndef __ASSEMBLY__
0008 #include <asm/processor.h>
0009 #include <asm/types.h>
0010 #include <asm/hwrpb.h>
0011 #include <asm/sysinfo.h>
0012 #endif
0013 
0014 #ifndef __ASSEMBLY__
0015 struct thread_info {
0016     struct pcb_struct   pcb;        /* palcode state */
0017 
0018     struct task_struct  *task;      /* main task structure */
0019     unsigned int        flags;      /* low level flags */
0020     unsigned int        ieee_state; /* see fpu.h */
0021 
0022     unsigned        cpu;        /* current CPU */
0023     int         preempt_count; /* 0 => preemptable, <0 => BUG */
0024     unsigned int        status;     /* thread-synchronous flags */
0025 
0026     int bpt_nsaved;
0027     unsigned long bpt_addr[2];      /* breakpoint handling  */
0028     unsigned int bpt_insn[2];
0029 };
0030 
0031 /*
0032  * Macros/functions for gaining access to the thread information structure.
0033  */
0034 #define INIT_THREAD_INFO(tsk)           \
0035 {                       \
0036     .task       = &tsk,         \
0037     .preempt_count  = INIT_PREEMPT_COUNT,   \
0038 }
0039 
0040 /* How to get the thread information struct from C.  */
0041 register struct thread_info *__current_thread_info __asm__("$8");
0042 #define current_thread_info()  __current_thread_info
0043 
0044 #endif /* __ASSEMBLY__ */
0045 
0046 /* Thread information allocation.  */
0047 #define THREAD_SIZE_ORDER 1
0048 #define THREAD_SIZE (2*PAGE_SIZE)
0049 
0050 /*
0051  * Thread information flags:
0052  * - these are process state flags and used from assembly
0053  * - pending work-to-be-done flags come first and must be assigned to be
0054  *   within bits 0 to 7 to fit in and immediate operand.
0055  *
0056  * TIF_SYSCALL_TRACE is known to be 0 via blbs.
0057  */
0058 #define TIF_SYSCALL_TRACE   0   /* syscall trace active */
0059 #define TIF_NOTIFY_RESUME   1   /* callback before returning to user */
0060 #define TIF_SIGPENDING      2   /* signal pending */
0061 #define TIF_NEED_RESCHED    3   /* rescheduling necessary */
0062 #define TIF_SYSCALL_AUDIT   4   /* syscall audit active */
0063 #define TIF_NOTIFY_SIGNAL   5   /* signal notifications exist */
0064 #define TIF_DIE_IF_KERNEL   9   /* dik recursion lock */
0065 #define TIF_MEMDIE      13  /* is terminating due to OOM killer */
0066 #define TIF_POLLING_NRFLAG  14  /* idle is polling for TIF_NEED_RESCHED */
0067 
0068 #define _TIF_SYSCALL_TRACE  (1<<TIF_SYSCALL_TRACE)
0069 #define _TIF_SIGPENDING     (1<<TIF_SIGPENDING)
0070 #define _TIF_NEED_RESCHED   (1<<TIF_NEED_RESCHED)
0071 #define _TIF_NOTIFY_RESUME  (1<<TIF_NOTIFY_RESUME)
0072 #define _TIF_SYSCALL_AUDIT  (1<<TIF_SYSCALL_AUDIT)
0073 #define _TIF_NOTIFY_SIGNAL  (1<<TIF_NOTIFY_SIGNAL)
0074 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
0075 
0076 /* Work to do on interrupt/exception return.  */
0077 #define _TIF_WORK_MASK      (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
0078                  _TIF_NOTIFY_RESUME)
0079 
0080 /* Work to do on any return to userspace.  */
0081 #define _TIF_ALLWORK_MASK   (_TIF_WORK_MASK     \
0082                  | _TIF_SYSCALL_TRACE)
0083 
0084 #define TS_UAC_NOPRINT      0x0001  /* ! Preserve the following three */
0085 #define TS_UAC_NOFIX        0x0002  /* ! flags as they match          */
0086 #define TS_UAC_SIGBUS       0x0004  /* ! userspace part of 'osf_sysinfo' */
0087 
0088 #define SET_UNALIGN_CTL(task,value) ({              \
0089     __u32 status = task_thread_info(task)->status & ~UAC_BITMASK;   \
0090     if (value & PR_UNALIGN_NOPRINT)                 \
0091         status |= TS_UAC_NOPRINT;               \
0092     if (value & PR_UNALIGN_SIGBUS)                  \
0093         status |= TS_UAC_SIGBUS;                \
0094     if (value & 4)  /* alpha-specific */                \
0095         status |= TS_UAC_NOFIX;                 \
0096     task_thread_info(task)->status = status;            \
0097     0; })
0098 
0099 #define GET_UNALIGN_CTL(task,value) ({              \
0100     __u32 status = task_thread_info(task)->status & ~UAC_BITMASK;   \
0101     __u32 res = 0;                          \
0102     if (status & TS_UAC_NOPRINT)                    \
0103         res |= PR_UNALIGN_NOPRINT;              \
0104     if (status & TS_UAC_SIGBUS)                 \
0105         res |= PR_UNALIGN_SIGBUS;               \
0106     if (status & TS_UAC_NOFIX)                  \
0107         res |= 4;                       \
0108     put_user(res, (int __user *)(value));               \
0109     })
0110 
0111 #endif /* __KERNEL__ */
0112 #endif /* _ALPHA_THREAD_INFO_H */