Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* thread_info.h: m68knommu low-level thread information |
| 2 | * adapted from the i386 and PPC versions by Greg Ungerer (gerg@snapgear.com) |
| 3 | * |
| 4 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) |
| 5 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller |
| 6 | */ |
| 7 | |
| 8 | #ifndef _ASM_THREAD_INFO_H |
| 9 | #define _ASM_THREAD_INFO_H |
| 10 | |
| 11 | #include <asm/page.h> |
| 12 | |
| 13 | #ifdef __KERNEL__ |
| 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | /* |
| 16 | * Size of kernel stack for each process. This must be a power of 2... |
| 17 | */ |
| 18 | #ifdef CONFIG_4KSTACKS |
| 19 | #define THREAD_SIZE_ORDER (0) |
| 20 | #else |
| 21 | #define THREAD_SIZE_ORDER (1) |
| 22 | #endif |
| 23 | |
| 24 | /* |
| 25 | * for asm files, THREAD_SIZE is now generated by asm-offsets.c |
| 26 | */ |
| 27 | #define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER) |
| 28 | |
Tim Abbott | d6cd1f0 | 2009-10-18 13:23:50 -0400 | [diff] [blame] | 29 | #ifndef __ASSEMBLY__ |
| 30 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | /* |
| 32 | * low level task data. |
| 33 | */ |
| 34 | struct thread_info { |
| 35 | struct task_struct *task; /* main task structure */ |
| 36 | struct exec_domain *exec_domain; /* execution domain */ |
| 37 | unsigned long flags; /* low level flags */ |
| 38 | int cpu; /* cpu we're on */ |
Jesper Juhl | dcd497f | 2005-06-23 00:09:07 -0700 | [diff] [blame] | 39 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
Maxim Kuvyrkov | a58f753 | 2009-12-06 10:08:14 -0800 | [diff] [blame] | 40 | unsigned long tp_value; /* thread pointer */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | struct restart_block restart_block; |
| 42 | }; |
| 43 | |
| 44 | /* |
| 45 | * macros/functions for gaining access to the thread information structure |
| 46 | */ |
| 47 | #define INIT_THREAD_INFO(tsk) \ |
| 48 | { \ |
| 49 | .task = &tsk, \ |
| 50 | .exec_domain = &default_exec_domain, \ |
| 51 | .flags = 0, \ |
| 52 | .cpu = 0, \ |
Peter Zijlstra | c99e6ef | 2009-07-10 14:57:56 +0200 | [diff] [blame] | 53 | .preempt_count = INIT_PREEMPT_COUNT, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | .restart_block = { \ |
| 55 | .fn = do_no_restart_syscall, \ |
| 56 | }, \ |
| 57 | } |
| 58 | |
| 59 | #define init_thread_info (init_thread_union.thread_info) |
| 60 | #define init_stack (init_thread_union.stack) |
| 61 | |
| 62 | |
| 63 | /* how to get the thread information struct from C */ |
| 64 | static inline struct thread_info *current_thread_info(void) |
| 65 | { |
| 66 | struct thread_info *ti; |
| 67 | __asm__( |
| 68 | "move.l %%sp, %0 \n\t" |
| 69 | "and.l %1, %0" |
| 70 | : "=&d"(ti) |
| 71 | : "di" (~(THREAD_SIZE-1)) |
| 72 | ); |
| 73 | return ti; |
| 74 | } |
| 75 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | #endif /* __ASSEMBLY__ */ |
| 77 | |
| 78 | #define PREEMPT_ACTIVE 0x4000000 |
| 79 | |
| 80 | /* |
| 81 | * thread information flag bit numbers |
| 82 | */ |
| 83 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
Stephane Eranian | a583f1b | 2007-07-31 00:38:00 -0700 | [diff] [blame] | 84 | #define TIF_SIGPENDING 1 /* signal pending */ |
| 85 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
| 86 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | TIF_NEED_RESCHED */ |
Stephane Eranian | a583f1b | 2007-07-31 00:38:00 -0700 | [diff] [blame] | 88 | #define TIF_MEMDIE 4 |
Matt Helsley | 83224b0 | 2008-10-18 20:27:18 -0700 | [diff] [blame] | 89 | #define TIF_FREEZE 16 /* is freezing for suspend */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
| 91 | /* as above, but as bit values */ |
| 92 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
| 94 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
| 95 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
Matt Helsley | 83224b0 | 2008-10-18 20:27:18 -0700 | [diff] [blame] | 96 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | |
| 98 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
| 99 | |
| 100 | #endif /* __KERNEL__ */ |
| 101 | |
| 102 | #endif /* _ASM_THREAD_INFO_H */ |