| 1 |
|
| 2 | #ifndef _ALPHA_THREAD_INFO_H
|
| 3 | #define _ALPHA_THREAD_INFO_H
|
| 4 |
|
| 5 | #ifdef __KERNEL__
|
| 6 |
|
| 7 | #ifndef __ASSEMBLER__
|
| 8 | #include <asm/processor.h>
|
| 9 | #include <asm/types.h>
|
| 10 | #include <asm/hwrpb.h>
|
| 11 | #include <asm/sysinfo.h>
|
| 12 | #endif
|
| 13 |
|
| 14 | #ifndef __ASSEMBLER__
|
| 15 |
|
| 16 | struct thread_info {
|
| 17 | struct pcb_struct pcb;
|
| 18 |
|
| 19 | struct task_struct *task;
|
| 20 | unsigned long flags;
|
| 21 | unsigned long syscall_work;
|
| 22 | unsigned int ieee_state;
|
| 23 |
|
| 24 | unsigned cpu;
|
| 25 | int preempt_count;
|
| 26 | unsigned int status;
|
| 27 | unsigned long syscall_saved_r19;
|
| 28 | unsigned long syscall_meta;
|
| 29 | unsigned long syscall_saved_nr;
|
| 30 |
|
| 31 | int bpt_nsaved;
|
| 32 | unsigned long bpt_addr[2];
|
| 33 | unsigned int bpt_insn[2];
|
| 34 | unsigned long fp[32];
|
| 35 | };
|
| 36 |
|
| 37 | |
| 38 | * Macros/functions for gaining access to the thread information structure.
|
| 39 |
|
| 40 | #define INIT_THREAD_INFO(tsk) \
|
| 41 | { \
|
| 42 | .task = &tsk, \
|
| 43 | .preempt_count = INIT_PREEMPT_COUNT, \
|
| 44 | }
|
| 45 |
|
| 46 |
|
| 47 | register struct thread_info *__current_thread_info __asm__("$8");
|
| 48 | #define current_thread_info() __current_thread_info
|
| 49 |
|
| 50 | register unsigned long *current_stack_pointer __asm__ ("$30");
|
| 51 |
|
| 52 | #endif
|
| 53 |
|
| 54 |
|
| 55 | #define THREAD_SIZE_ORDER 1
|
| 56 | #define THREAD_SIZE (2*PAGE_SIZE)
|
| 57 |
|
| 58 | #define ALPHA_SYSCALL_META_SKIP 0x2
|
| 59 | #define ALPHA_SYSCALL_META_FORCE_SUCCESS 0x4
|
| 60 |
|
| 61 | |
| 62 | * Thread information flags:
|
| 63 | * - these are process state flags and used from assembly
|
| 64 | * - pending work-to-be-done flags come first and must be assigned to be
|
| 65 | * within bits 0 to 7 to fit in and immediate operand.
|
| 66 | *
|
| 67 | * (Historically TIF_SYSCALL_TRACE was known to be 0 via blbs, but we may
|
| 68 | * also test multiple bits via masks now.)
|
| 69 |
|
| 70 | #define TIF_SYSCALL_TRACE 0
|
| 71 | #define TIF_NOTIFY_RESUME 1
|
| 72 | #define TIF_SIGPENDING 2
|
| 73 | #define TIF_NEED_RESCHED 3
|
| 74 | #define TIF_SYSCALL_AUDIT 4
|
| 75 | #define TIF_NOTIFY_SIGNAL 5
|
| 76 | #define TIF_SECCOMP 6
|
| 77 | #define TIF_SYSCALL_TRACEPOINT 7
|
| 78 | #define TIF_DIE_IF_KERNEL 9
|
| 79 | #define TIF_UPROBE 10
|
| 80 | #define TIF_MEMDIE 13
|
| 81 | #define TIF_POLLING_NRFLAG 14
|
| 82 |
|
| 83 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
|
| 84 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
|
| 85 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
|
| 86 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
|
| 87 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
|
| 88 | #define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)
|
| 89 | #define _TIF_SECCOMP (1<<TIF_SECCOMP)
|
| 90 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
|
| 91 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
|
| 92 | #define _TIF_UPROBE (1 << TIF_UPROBE)
|
| 93 |
|
| 94 | #define TS_UAC_NOPRINT 0x0001
|
| 95 | #define TS_UAC_NOFIX 0x0002
|
| 96 | #define TS_UAC_SIGBUS 0x0004
|
| 97 |
|
| 98 | #define TS_SAVED_FP 0x0008
|
| 99 | #define TS_RESTORE_FP 0x0010
|
| 100 |
|
| 101 | #define SET_UNALIGN_CTL(task,value) ({ \
|
| 102 | __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
|
| 103 | if (value & PR_UNALIGN_NOPRINT) \
|
| 104 | status |= TS_UAC_NOPRINT; \
|
| 105 | if (value & PR_UNALIGN_SIGBUS) \
|
| 106 | status |= TS_UAC_SIGBUS; \
|
| 107 | if (value & 4) \
|
| 108 | status |= TS_UAC_NOFIX; \
|
| 109 | task_thread_info(task)->status = status; \
|
| 110 | 0; })
|
| 111 |
|
| 112 | #define GET_UNALIGN_CTL(task,value) ({ \
|
| 113 | __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
|
| 114 | __u32 res = 0; \
|
| 115 | if (status & TS_UAC_NOPRINT) \
|
| 116 | res |= PR_UNALIGN_NOPRINT; \
|
| 117 | if (status & TS_UAC_SIGBUS) \
|
| 118 | res |= PR_UNALIGN_SIGBUS; \
|
| 119 | if (status & TS_UAC_NOFIX) \
|
| 120 | res |= 4; \
|
| 121 | put_user(res, (int __user *)(value)); \
|
| 122 | })
|
| 123 |
|
| 124 | #ifndef __ASSEMBLER__
|
| 125 | extern void __save_fpu(void);
|
| 126 |
|
| 127 | static inline void save_fpu(void)
|
| 128 | {
|
| 129 | if (!(current_thread_info()->status & TS_SAVED_FP)) {
|
| 130 | current_thread_info()->status |= TS_SAVED_FP;
|
| 131 | __save_fpu();
|
| 132 | }
|
| 133 | }
|
| 134 | #endif
|
| 135 |
|
| 136 | #endif
|
| 137 | #endif
|