| 1 | |
| 2 | * include/asm-xtensa/thread_info.h
|
| 3 | *
|
| 4 | * This file is subject to the terms and conditions of the GNU General Public
|
| 5 | * License. See the file "COPYING" in the main directory of this archive
|
| 6 | * for more details.
|
| 7 | *
|
| 8 | * Copyright (C) 2001 - 2005 Tensilica Inc.
|
| 9 |
|
| 10 |
|
| 11 | #ifndef _XTENSA_THREAD_INFO_H
|
| 12 | #define _XTENSA_THREAD_INFO_H
|
| 13 |
|
| 14 | #include <linux/stringify.h>
|
| 15 | #include <asm/kmem_layout.h>
|
| 16 |
|
| 17 | #define CURRENT_SHIFT KERNEL_STACK_SHIFT
|
| 18 |
|
| 19 | #ifndef __ASSEMBLER__
|
| 20 | # include <asm/processor.h>
|
| 21 | #endif
|
| 22 |
|
| 23 | |
| 24 | * low level task data that entry.S needs immediate access to
|
| 25 | * - this struct should fit entirely inside of one cache line
|
| 26 | * - this struct shares the supervisor stack pages
|
| 27 | * - if the contents of this structure are changed, the assembly constants
|
| 28 | * must also be changed
|
| 29 |
|
| 30 |
|
| 31 | #ifndef __ASSEMBLER__
|
| 32 |
|
| 33 | #if XTENSA_HAVE_COPROCESSORS
|
| 34 |
|
| 35 | typedef struct xtregs_coprocessor {
|
| 36 | xtregs_cp0_t cp0;
|
| 37 | xtregs_cp1_t cp1;
|
| 38 | xtregs_cp2_t cp2;
|
| 39 | xtregs_cp3_t cp3;
|
| 40 | xtregs_cp4_t cp4;
|
| 41 | xtregs_cp5_t cp5;
|
| 42 | xtregs_cp6_t cp6;
|
| 43 | xtregs_cp7_t cp7;
|
| 44 | } xtregs_coprocessor_t;
|
| 45 |
|
| 46 | #endif
|
| 47 |
|
| 48 | struct thread_info {
|
| 49 | struct task_struct *task;
|
| 50 | unsigned long flags;
|
| 51 | unsigned long status;
|
| 52 | __u32 cpu;
|
| 53 | __s32 preempt_count;
|
| 54 |
|
| 55 | #if XCHAL_HAVE_EXCLUSIVE
|
| 56 |
|
| 57 | unsigned long atomctl8;
|
| 58 | #endif
|
| 59 | #ifdef CONFIG_USER_ABI_CALL0_PROBE
|
| 60 |
|
| 61 | unsigned long ps_woe_fix_addr;
|
| 62 | #endif
|
| 63 |
|
| 64 | |
| 65 | * If i-th bit is set then coprocessor state is loaded into the
|
| 66 | * coprocessor i on CPU cp_owner_cpu.
|
| 67 |
|
| 68 | unsigned long cpenable;
|
| 69 | u32 cp_owner_cpu;
|
| 70 |
|
| 71 | #if XTENSA_HAVE_COPROCESSORS
|
| 72 | xtregs_coprocessor_t xtregs_cp;
|
| 73 | #endif
|
| 74 | xtregs_user_t xtregs_user;
|
| 75 | };
|
| 76 |
|
| 77 | #endif
|
| 78 |
|
| 79 | |
| 80 | * macros/functions for gaining access to the thread information structure
|
| 81 |
|
| 82 |
|
| 83 | #ifndef __ASSEMBLER__
|
| 84 |
|
| 85 | #define INIT_THREAD_INFO(tsk) \
|
| 86 | { \
|
| 87 | .task = &tsk, \
|
| 88 | .flags = 0, \
|
| 89 | .cpu = 0, \
|
| 90 | .preempt_count = INIT_PREEMPT_COUNT, \
|
| 91 | }
|
| 92 |
|
| 93 |
|
| 94 | static __always_inline struct thread_info *current_thread_info(void)
|
| 95 | {
|
| 96 | struct thread_info *ti;
|
| 97 | __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"
|
| 98 | "xor %0, a1, %0" : "=&r" (ti) : );
|
| 99 | return ti;
|
| 100 | }
|
| 101 |
|
| 102 | #else
|
| 103 |
|
| 104 |
|
| 105 | #define GET_THREAD_INFO(reg,sp) \
|
| 106 | extui reg, sp, 0, CURRENT_SHIFT; \
|
| 107 | xor reg, sp, reg
|
| 108 | #endif
|
| 109 |
|
| 110 |
|
| 111 | |
| 112 | * thread information flags
|
| 113 | * - these are process state flags that various assembly files may need to access
|
| 114 |
|
| 115 | #define TIF_SYSCALL_TRACE 0
|
| 116 | #define TIF_SIGPENDING 1
|
| 117 | #define TIF_NEED_RESCHED 2
|
| 118 | #define TIF_SINGLESTEP 3
|
| 119 | #define TIF_SYSCALL_TRACEPOINT 4
|
| 120 | #define TIF_NOTIFY_SIGNAL 5
|
| 121 | #define TIF_RESTORE_SIGMASK 6
|
| 122 | #define TIF_NOTIFY_RESUME 7
|
| 123 | #define TIF_DB_DISABLED 8
|
| 124 | #define TIF_SYSCALL_AUDIT 9
|
| 125 | #define TIF_SECCOMP 10
|
| 126 | #define TIF_MEMDIE 11
|
| 127 |
|
| 128 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
|
| 129 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
|
| 130 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
|
| 131 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
|
| 132 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
|
| 133 | #define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)
|
| 134 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
|
| 135 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
|
| 136 | #define _TIF_SECCOMP (1<<TIF_SECCOMP)
|
| 137 |
|
| 138 | #define _TIF_WORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
|
| 139 | _TIF_SYSCALL_TRACEPOINT | \
|
| 140 | _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
|
| 141 |
|
| 142 | #define THREAD_SIZE KERNEL_STACK_SIZE
|
| 143 | #define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT)
|
| 144 |
|
| 145 | #endif
|