root/arch/unicore32/include/asm/thread_info.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. current_thread_info

   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * linux/arch/unicore32/include/asm/thread_info.h
   4  *
   5  * Code specific to PKUnity SoC and UniCore ISA
   6  *
   7  * Copyright (C) 2001-2010 GUAN Xue-tao
   8  */
   9 #ifndef __UNICORE_THREAD_INFO_H__
  10 #define __UNICORE_THREAD_INFO_H__
  11 
  12 #ifdef __KERNEL__
  13 
  14 #include <linux/compiler.h>
  15 #include <asm/fpstate.h>
  16 
  17 #define THREAD_SIZE_ORDER       1
  18 #define THREAD_SIZE             8192
  19 #define THREAD_START_SP         (THREAD_SIZE - 8)
  20 
  21 #ifndef __ASSEMBLY__
  22 
  23 struct task_struct;
  24 
  25 #include <asm/types.h>
  26 
  27 typedef struct {
  28         unsigned long seg;
  29 } mm_segment_t;
  30 
  31 struct cpu_context_save {
  32         __u32   r4;
  33         __u32   r5;
  34         __u32   r6;
  35         __u32   r7;
  36         __u32   r8;
  37         __u32   r9;
  38         __u32   r10;
  39         __u32   r11;
  40         __u32   r12;
  41         __u32   r13;
  42         __u32   r14;
  43         __u32   r15;
  44         __u32   r16;
  45         __u32   r17;
  46         __u32   r18;
  47         __u32   r19;
  48         __u32   r20;
  49         __u32   r21;
  50         __u32   r22;
  51         __u32   r23;
  52         __u32   r24;
  53         __u32   r25;
  54         __u32   r26;
  55         __u32   fp;
  56         __u32   sp;
  57         __u32   pc;
  58 };
  59 
  60 /*
  61  * low level task data that entry.S needs immediate access to.
  62  * __switch_to() assumes cpu_context follows immediately after cpu_domain.
  63  */
  64 struct thread_info {
  65         unsigned long           flags;          /* low level flags */
  66         int                     preempt_count;  /* 0 => preemptable */
  67                                                 /* <0 => bug */
  68         mm_segment_t            addr_limit;     /* address limit */
  69         struct task_struct      *task;          /* main task structure */
  70         __u32                   cpu;            /* cpu */
  71         struct cpu_context_save cpu_context;    /* cpu context */
  72         __u32                   syscall;        /* syscall number */
  73         __u8                    used_cp[16];    /* thread used copro */
  74 #ifdef CONFIG_UNICORE_FPU_F64
  75         struct fp_state         fpstate __attribute__((aligned(8)));
  76 #endif
  77 };
  78 
  79 #define INIT_THREAD_INFO(tsk)                                           \
  80 {                                                                       \
  81         .task           = &tsk,                                         \
  82         .flags          = 0,                                            \
  83         .preempt_count  = INIT_PREEMPT_COUNT,                           \
  84         .addr_limit     = KERNEL_DS,                                    \
  85 }
  86 
  87 /*
  88  * how to get the thread information struct from C
  89  */
  90 static inline struct thread_info *current_thread_info(void) __attribute_const__;
  91 
  92 static inline struct thread_info *current_thread_info(void)
  93 {
  94         register unsigned long sp asm ("sp");
  95         return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
  96 }
  97 
  98 #define thread_saved_pc(tsk)    \
  99         ((unsigned long)(task_thread_info(tsk)->cpu_context.pc))
 100 #define thread_saved_sp(tsk)    \
 101         ((unsigned long)(task_thread_info(tsk)->cpu_context.sp))
 102 #define thread_saved_fp(tsk)    \
 103         ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
 104 
 105 #endif
 106 
 107 /*
 108  * thread information flags:
 109  *  TIF_SYSCALL_TRACE   - syscall trace active
 110  *  TIF_SIGPENDING      - signal pending
 111  *  TIF_NEED_RESCHED    - rescheduling necessary
 112  *  TIF_NOTIFY_RESUME   - callback before returning to user
 113  */
 114 #define TIF_SIGPENDING          0
 115 #define TIF_NEED_RESCHED        1
 116 #define TIF_NOTIFY_RESUME       2       /* callback before returning to user */
 117 #define TIF_SYSCALL_TRACE       8
 118 #define TIF_MEMDIE              18
 119 #define TIF_RESTORE_SIGMASK     20
 120 
 121 #define _TIF_SIGPENDING         (1 << TIF_SIGPENDING)
 122 #define _TIF_NEED_RESCHED       (1 << TIF_NEED_RESCHED)
 123 #define _TIF_NOTIFY_RESUME      (1 << TIF_NOTIFY_RESUME)
 124 #define _TIF_SYSCALL_TRACE      (1 << TIF_SYSCALL_TRACE)
 125 
 126 /*
 127  * Change these and you break ASM code in entry-common.S
 128  */
 129 #define _TIF_WORK_MASK \
 130         (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
 131 
 132 #endif /* __KERNEL__ */
 133 #endif /* __UNICORE_THREAD_INFO_H__ */

/* [<][>][^][v][top][bottom][index][help] */