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> |
| 10 | #endif |
| 11 | |
| 12 | #ifndef __ASSEMBLY__ |
| 13 | struct thread_info { |
| 14 | struct pcb_struct pcb; /* palcode state */ |
| 15 | |
| 16 | struct task_struct *task; /* main task structure */ |
| 17 | unsigned int flags; /* low level flags */ |
| 18 | unsigned int ieee_state; /* see fpu.h */ |
| 19 | |
| 20 | struct exec_domain *exec_domain; /* execution domain */ |
| 21 | mm_segment_t addr_limit; /* thread address space */ |
| 22 | unsigned cpu; /* current CPU */ |
| 23 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
| 24 | |
| 25 | int bpt_nsaved; |
| 26 | unsigned long bpt_addr[2]; /* breakpoint handling */ |
| 27 | unsigned int bpt_insn[2]; |
| 28 | |
| 29 | struct restart_block restart_block; |
| 30 | }; |
| 31 | |
| 32 | /* |
| 33 | * Macros/functions for gaining access to the thread information structure. |
| 34 | */ |
| 35 | #define INIT_THREAD_INFO(tsk) \ |
| 36 | { \ |
| 37 | .task = &tsk, \ |
| 38 | .exec_domain = &default_exec_domain, \ |
| 39 | .addr_limit = KERNEL_DS, \ |
Peter Zijlstra | c99e6ef | 2009-07-10 14:57:56 +0200 | [diff] [blame] | 40 | .preempt_count = INIT_PREEMPT_COUNT, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | .restart_block = { \ |
| 42 | .fn = do_no_restart_syscall, \ |
| 43 | }, \ |
| 44 | } |
| 45 | |
| 46 | #define init_thread_info (init_thread_union.thread_info) |
| 47 | #define init_stack (init_thread_union.stack) |
| 48 | |
| 49 | /* How to get the thread information struct from C. */ |
| 50 | register struct thread_info *__current_thread_info __asm__("$8"); |
| 51 | #define current_thread_info() __current_thread_info |
| 52 | |
Andrew Morton | 15f3c47 | 2009-11-11 14:26:30 -0800 | [diff] [blame] | 53 | #endif /* __ASSEMBLY__ */ |
| 54 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | /* Thread information allocation. */ |
FUJITA Tomonori | b69c49b | 2008-07-25 01:45:40 -0700 | [diff] [blame] | 56 | #define THREAD_SIZE_ORDER 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #define THREAD_SIZE (2*PAGE_SIZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #define PREEMPT_ACTIVE 0x40000000 |
| 60 | |
| 61 | /* |
| 62 | * Thread information flags: |
| 63 | * - these are process state flags and used from assembly |
Michael Cree | 745dd240 | 2009-11-30 22:44:40 -0500 | [diff] [blame] | 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 | * - ALPHA_UAC_SHIFT below must be kept consistent with the unaligned |
| 67 | * control flags. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | * |
| 69 | * TIF_SYSCALL_TRACE is known to be 0 via blbs. |
| 70 | */ |
| 71 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
Michael Cree | 745dd240 | 2009-11-30 22:44:40 -0500 | [diff] [blame] | 72 | #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ |
| 73 | #define TIF_SIGPENDING 2 /* signal pending */ |
| 74 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
| 75 | #define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */ |
| 76 | #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */ |
Sergei Trofimovich | 2df7a7d | 2011-08-25 15:59:02 -0700 | [diff] [blame] | 77 | #define TIF_UAC_NOPRINT 10 /* ! Preserve sequence of following */ |
| 78 | #define TIF_UAC_NOFIX 11 /* ! flags as they match */ |
| 79 | #define TIF_UAC_SIGBUS 12 /* ! userspace part of 'osf_sysinfo' */ |
Andreas Dilger | 0ddc932 | 2010-05-14 11:13:27 +0200 | [diff] [blame] | 80 | #define TIF_MEMDIE 13 /* is terminating due to OOM killer */ |
Michael Cree | 745dd240 | 2009-11-30 22:44:40 -0500 | [diff] [blame] | 81 | #define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
| 83 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 84 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
| 85 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
| 86 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
Richard Henderson | b927b3e | 2007-05-29 16:03:28 -0700 | [diff] [blame] | 87 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
David Howells | d0420c8 | 2009-09-02 09:14:16 +0100 | [diff] [blame] | 88 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
| 90 | /* Work to do on interrupt/exception return. */ |
David Howells | d0420c8 | 2009-09-02 09:14:16 +0100 | [diff] [blame] | 91 | #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \ |
| 92 | _TIF_NOTIFY_RESUME) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | |
| 94 | /* Work to do on any return to userspace. */ |
| 95 | #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \ |
| 96 | | _TIF_SYSCALL_TRACE) |
| 97 | |
Sergei Trofimovich | 2df7a7d | 2011-08-25 15:59:02 -0700 | [diff] [blame] | 98 | #define ALPHA_UAC_SHIFT TIF_UAC_NOPRINT |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 99 | #define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \ |
| 100 | 1 << TIF_UAC_SIGBUS) |
| 101 | |
| 102 | #define SET_UNALIGN_CTL(task,value) ({ \ |
Roman Zippel | f7e4217 | 2007-05-09 02:35:17 -0700 | [diff] [blame] | 103 | task_thread_info(task)->flags = ((task_thread_info(task)->flags & \ |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 104 | ~ALPHA_UAC_MASK) \ |
| 105 | | (((value) << ALPHA_UAC_SHIFT) & (1<<TIF_UAC_NOPRINT))\ |
| 106 | | (((value) << (ALPHA_UAC_SHIFT + 1)) & (1<<TIF_UAC_SIGBUS)) \ |
| 107 | | (((value) << (ALPHA_UAC_SHIFT - 1)) & (1<<TIF_UAC_NOFIX)));\ |
| 108 | 0; }) |
| 109 | |
| 110 | #define GET_UNALIGN_CTL(task,value) ({ \ |
Roman Zippel | f7e4217 | 2007-05-09 02:35:17 -0700 | [diff] [blame] | 111 | put_user((task_thread_info(task)->flags & (1 << TIF_UAC_NOPRINT))\ |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 112 | >> ALPHA_UAC_SHIFT \ |
Roman Zippel | f7e4217 | 2007-05-09 02:35:17 -0700 | [diff] [blame] | 113 | | (task_thread_info(task)->flags & (1 << TIF_UAC_SIGBUS))\ |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 114 | >> (ALPHA_UAC_SHIFT + 1) \ |
Roman Zippel | f7e4217 | 2007-05-09 02:35:17 -0700 | [diff] [blame] | 115 | | (task_thread_info(task)->flags & (1 << TIF_UAC_NOFIX))\ |
Ivan Kokshaysky | ed58a59 | 2007-05-06 14:50:38 -0700 | [diff] [blame] | 116 | >> (ALPHA_UAC_SHIFT - 1), \ |
| 117 | (int __user *)(value)); \ |
| 118 | }) |
| 119 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | #endif /* __KERNEL__ */ |
| 121 | #endif /* _ALPHA_THREAD_INFO_H */ |