Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ALPHA_THREAD_INFO_H |
| 2 | #define _ALPHA_THREAD_INFO_H |
| 3 | |
| 4 | #ifdef __KERNEL__ |
| 5 | |
| 6 | #ifndef __ASSEMBLY__ |
| 7 | #include <asm/processor.h> |
| 8 | #include <asm/types.h> |
| 9 | #include <asm/hwrpb.h> |
Al Viro | 3185bd2 | 2012-10-20 15:52:23 +0100 | [diff] [blame] | 10 | #include <asm/sysinfo.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #endif |
| 12 | |
| 13 | #ifndef __ASSEMBLY__ |
| 14 | struct thread_info { |
| 15 | struct pcb_struct pcb; /* palcode state */ |
| 16 | |
| 17 | struct task_struct *task; /* main task structure */ |
| 18 | unsigned int flags; /* low level flags */ |
| 19 | unsigned int ieee_state; /* see fpu.h */ |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | mm_segment_t addr_limit; /* thread address space */ |
| 22 | unsigned cpu; /* current CPU */ |
| 23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
Al Viro | 3185bd2 | 2012-10-20 15:52:23 +0100 | [diff] [blame] | 24 | unsigned int status; /* thread-synchronous flags */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | int bpt_nsaved; |
| 27 | unsigned long bpt_addr[2]; /* breakpoint handling */ |
| 28 | unsigned int bpt_insn[2]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | /* |
| 32 | * Macros/functions for gaining access to the thread information structure. |
| 33 | */ |
| 34 | #define INIT_THREAD_INFO(tsk) \ |
| 35 | { \ |
| 36 | .task = &tsk, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | .addr_limit = KERNEL_DS, \ |
Peter Zijlstra | c99e6ef | 2009-07-10 14:57:56 +0200 | [diff] [blame] | 38 | .preempt_count = INIT_PREEMPT_COUNT, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | #define init_thread_info (init_thread_union.thread_info) |
| 42 | #define init_stack (init_thread_union.stack) |
| 43 | |
| 44 | /* How to get the thread information struct from C. */ |
| 45 | register struct thread_info *__current_thread_info __asm__("$8"); |
| 46 | #define current_thread_info() __current_thread_info |
| 47 | |
Andrew Morton | 15f3c47 | 2009-11-11 14:26:30 -0800 | [diff] [blame] | 48 | #endif /* __ASSEMBLY__ */ |
| 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | /* Thread information allocation. */ |
FUJITA Tomonori | b69c49b | 2008-07-25 01:45:40 -0700 | [diff] [blame] | 51 | #define THREAD_SIZE_ORDER 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #define THREAD_SIZE (2*PAGE_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | /* |
| 55 | * Thread information flags: |
| 56 | * - these are process state flags and used from assembly |
Michael Cree | 745dd240 | 2009-11-30 22:44:40 -0500 | [diff] [blame] | 57 | * - pending work-to-be-done flags come first and must be assigned to be |
| 58 | * within bits 0 to 7 to fit in and immediate operand. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | * |
| 60 | * TIF_SYSCALL_TRACE is known to be 0 via blbs. |
| 61 | */ |
| 62 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
Michael Cree | 745dd240 | 2009-11-30 22:44:40 -0500 | [diff] [blame] | 63 | #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ |
| 64 | #define TIF_SIGPENDING 2 /* signal pending */ |
| 65 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
蔡正龙 | a9302e8 | 2013-12-20 10:04:10 +0800 | [diff] [blame] | 66 | #define TIF_SYSCALL_AUDIT 4 /* syscall audit active */ |
Michael Cree | 745dd240 | 2009-11-30 22:44:40 -0500 | [diff] [blame] | 67 | #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ |
Andreas Dilger | 0ddc932 | 2010-05-14 11:13:27 +0200 | [diff] [blame] | 68 | #define TIF_MEMDIE 13 /* is terminating due to OOM killer */ |
Peter Zijlstra | 2a705ad | 2014-04-11 09:59:17 +0200 | [diff] [blame] | 69 | #define TIF_POLLING_NRFLAG 14 /* idle is polling for TIF_NEED_RESCHED */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | |
| 71 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
| 73 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
David Howells | d0420c8 | 2009-09-02 09:14:16 +0100 | [diff] [blame] | 74 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
蔡正龙 | a9302e8 | 2013-12-20 10:04:10 +0800 | [diff] [blame] | 75 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) |
Peter Zijlstra | 2a705ad | 2014-04-11 09:59:17 +0200 | [diff] [blame] | 76 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
| 78 | /* Work to do on interrupt/exception return. */ |
David Howells | d0420c8 | 2009-09-02 09:14:16 +0100 | [diff] [blame] | 79 | #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ |
| 80 | _TIF_NOTIFY_RESUME) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | |
| 82 | /* Work to do on any return to userspace. */ |
| 83 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \ |
| 84 | | _TIF_SYSCALL_TRACE) |
| 85 | |
Al Viro | 3185bd2 | 2012-10-20 15:52:23 +0100 | [diff] [blame] | 86 | #define TS_UAC_NOPRINT 0x0001 /* ! Preserve the following three */ |
| 87 | #define TS_UAC_NOFIX 0x0002 /* ! flags as they match */ |
| 88 | #define TS_UAC_SIGBUS 0x0004 /* ! userspace part of 'osf_sysinfo' */ |
Al Viro | 3185bd2 | 2012-10-20 15:52:23 +0100 | [diff] [blame] | 89 | |
| 90 | #define SET_UNALIGN_CTL(task,value) ({ \ |
| 91 | __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \ |
| 92 | if (value & PR_UNALIGN_NOPRINT) \ |
| 93 | status |= TS_UAC_NOPRINT; \ |
| 94 | if (value & PR_UNALIGN_SIGBUS) \ |
| 95 | status |= TS_UAC_SIGBUS; \ |
| 96 | if (value & 4) /* alpha-specific */ \ |
| 97 | status |= TS_UAC_NOFIX; \ |
| 98 | task_thread_info(task)->status = status; \ |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 99 | 0; }) |
| 100 | |
| 101 | #define GET_UNALIGN_CTL(task,value) ({ \ |
Al Viro | 3185bd2 | 2012-10-20 15:52:23 +0100 | [diff] [blame] | 102 | __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \ |
| 103 | __u32 res = 0; \ |
| 104 | if (status & TS_UAC_NOPRINT) \ |
| 105 | res |= PR_UNALIGN_NOPRINT; \ |
| 106 | if (status & TS_UAC_SIGBUS) \ |
| 107 | res |= PR_UNALIGN_SIGBUS; \ |
| 108 | if (status & TS_UAC_NOFIX) \ |
| 109 | res |= 4; \ |
| 110 | put_user(res, (int __user *)(value)); \ |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 111 | }) |
| 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | #endif /* __KERNEL__ */ |
| 114 | #endif /* _ALPHA_THREAD_INFO_H */ |