Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * thread_info.h: sparc low-level thread information
0004  * adapted from the ppc version by Pete Zaitcev, which was
0005  * adapted from the i386 version by Paul Mackerras
0006  *
0007  * Copyright (C) 2002  David Howells (dhowells@redhat.com)
0008  * Copyright (c) 2002  Pete Zaitcev (zaitcev@yahoo.com)
0009  * - Incorporating suggestions made by Linus Torvalds and Dave Miller
0010  */
0011 
0012 #ifndef _ASM_THREAD_INFO_H
0013 #define _ASM_THREAD_INFO_H
0014 
0015 #ifdef __KERNEL__
0016 
0017 #ifndef __ASSEMBLY__
0018 
0019 #include <asm/ptrace.h>
0020 #include <asm/page.h>
0021 
0022 /*
0023  * Low level task data.
0024  *
0025  * If you change this, change the TI_* offsets below to match.
0026  */
0027 #define NSWINS 8
0028 struct thread_info {
0029     unsigned long       uwinmask;
0030     struct task_struct  *task;      /* main task structure */
0031     unsigned long       flags;      /* low level flags */
0032     int         cpu;        /* cpu we're on */
0033     int         preempt_count;  /* 0 => preemptable,
0034                            <0 => BUG */
0035     int         softirq_count;
0036     int         hardirq_count;
0037 
0038     u32 __unused;
0039 
0040     /* Context switch saved kernel state. */
0041     unsigned long ksp;  /* ... ksp __attribute__ ((aligned (8))); */
0042     unsigned long kpc;
0043     unsigned long kpsr;
0044     unsigned long kwim;
0045 
0046     /* A place to store user windows and stack pointers
0047      * when the stack needs inspection.
0048      */
0049     struct reg_window32 reg_window[NSWINS]; /* align for ldd! */
0050     unsigned long       rwbuf_stkptrs[NSWINS];
0051     unsigned long       w_saved;
0052 };
0053 
0054 /*
0055  * macros/functions for gaining access to the thread information structure
0056  */
0057 #define INIT_THREAD_INFO(tsk)               \
0058 {                           \
0059     .uwinmask   =   0,          \
0060     .task       =   &tsk,           \
0061     .flags      =   0,          \
0062     .cpu        =   0,          \
0063     .preempt_count  =   INIT_PREEMPT_COUNT, \
0064 }
0065 
0066 /* how to get the thread information struct from C */
0067 register struct thread_info *current_thread_info_reg asm("g6");
0068 #define current_thread_info()   (current_thread_info_reg)
0069 
0070 /*
0071  * thread information allocation
0072  */
0073 #define THREAD_SIZE_ORDER  1
0074 
0075 #endif /* __ASSEMBLY__ */
0076 
0077 /* Size of kernel stack for each process */
0078 #define THREAD_SIZE     (2 * PAGE_SIZE)
0079 
0080 /*
0081  * Offsets in thread_info structure, used in assembly code
0082  * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
0083  */
0084 #define TI_UWINMASK 0x00    /* uwinmask */
0085 #define TI_TASK     0x04
0086 #define TI_FLAGS    0x08
0087 #define TI_CPU      0x0c
0088 #define TI_PREEMPT  0x10    /* preempt_count */
0089 #define TI_SOFTIRQ  0x14    /* softirq_count */
0090 #define TI_HARDIRQ  0x18    /* hardirq_count */
0091 #define TI_KSP      0x20    /* ksp */
0092 #define TI_KPC      0x24    /* kpc (ldd'ed with kpc) */
0093 #define TI_KPSR     0x28    /* kpsr */
0094 #define TI_KWIM     0x2c    /* kwim (ldd'ed with kpsr) */
0095 #define TI_REG_WINDOW   0x30
0096 #define TI_RWIN_SPTRS   0x230
0097 #define TI_W_SAVED  0x250
0098 
0099 /*
0100  * thread information flag bit numbers
0101  */
0102 #define TIF_SYSCALL_TRACE   0   /* syscall trace active */
0103 #define TIF_NOTIFY_RESUME   1   /* callback before returning to user */
0104 #define TIF_SIGPENDING      2   /* signal pending */
0105 #define TIF_NEED_RESCHED    3   /* rescheduling necessary */
0106 #define TIF_RESTORE_SIGMASK 4   /* restore signal mask in do_signal() */
0107 #define TIF_NOTIFY_SIGNAL   5   /* signal notifications exist */
0108 #define TIF_USEDFPU     8   /* FPU was used by this task
0109                      * this quantum (SMP) */
0110 #define TIF_POLLING_NRFLAG  9   /* true if poll_idle() is polling
0111                      * TIF_NEED_RESCHED */
0112 #define TIF_MEMDIE      10  /* is terminating due to OOM killer */
0113 
0114 /* as above, but as bit values */
0115 #define _TIF_SYSCALL_TRACE  (1<<TIF_SYSCALL_TRACE)
0116 #define _TIF_NOTIFY_RESUME  (1<<TIF_NOTIFY_RESUME)
0117 #define _TIF_SIGPENDING     (1<<TIF_SIGPENDING)
0118 #define _TIF_NEED_RESCHED   (1<<TIF_NEED_RESCHED)
0119 #define _TIF_NOTIFY_SIGNAL  (1<<TIF_NOTIFY_SIGNAL)
0120 #define _TIF_USEDFPU        (1<<TIF_USEDFPU)
0121 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
0122 
0123 #define _TIF_DO_NOTIFY_RESUME_MASK  (_TIF_NOTIFY_RESUME | \
0124                      _TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)
0125 
0126 #define is_32bit_task() (1)
0127 
0128 #endif /* __KERNEL__ */
0129 
0130 #endif /* _ASM_THREAD_INFO_H */