Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* thread_info.h: CRIS low-level thread information |
| 2 | * |
| 3 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) |
| 4 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller |
| 5 | * |
| 6 | * CRIS port by Axis Communications |
| 7 | */ |
| 8 | |
| 9 | #ifndef _ASM_THREAD_INFO_H |
| 10 | #define _ASM_THREAD_INFO_H |
| 11 | |
| 12 | #ifdef __KERNEL__ |
| 13 | |
| 14 | #ifndef __ASSEMBLY__ |
| 15 | #include <asm/types.h> |
| 16 | #include <asm/processor.h> |
Jesper Nilsson | 556dcee | 2008-10-21 17:45:58 +0200 | [diff] [blame] | 17 | #include <arch/thread_info.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <asm/segment.h> |
| 19 | #endif |
| 20 | |
| 21 | |
| 22 | /* |
| 23 | * low level task data that entry.S needs immediate access to |
| 24 | * - this struct should fit entirely inside of one cache line |
| 25 | * - this struct shares the supervisor stack pages |
| 26 | * - if the contents of this structure are changed, the assembly constants must also be changed |
| 27 | */ |
| 28 | #ifndef __ASSEMBLY__ |
| 29 | struct thread_info { |
| 30 | struct task_struct *task; /* main task structure */ |
| 31 | struct exec_domain *exec_domain; /* execution domain */ |
| 32 | unsigned long flags; /* low level flags */ |
| 33 | __u32 cpu; /* current CPU */ |
Jesper Juhl | dcd497f | 2005-06-23 00:09:07 -0700 | [diff] [blame] | 34 | int preempt_count; /* 0 => preemptable, <0 => BUG */ |
Jesper Nilsson | 7b27552 | 2007-11-14 17:00:59 -0800 | [diff] [blame] | 35 | __u32 tls; /* TLS for this thread */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | mm_segment_t addr_limit; /* thread address space: |
| 38 | 0-0xBFFFFFFF for user-thead |
| 39 | 0-0xFFFFFFFF for kernel-thread |
| 40 | */ |
| 41 | struct restart_block restart_block; |
| 42 | __u8 supervisor_stack[0]; |
| 43 | }; |
| 44 | |
| 45 | #endif |
| 46 | |
Mikael Starvik | 5d01e6c | 2005-07-27 11:44:43 -0700 | [diff] [blame] | 47 | #define PREEMPT_ACTIVE 0x10000000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | /* |
| 50 | * macros/functions for gaining access to the thread information structure |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | */ |
| 52 | #ifndef __ASSEMBLY__ |
| 53 | #define INIT_THREAD_INFO(tsk) \ |
| 54 | { \ |
| 55 | .task = &tsk, \ |
| 56 | .exec_domain = &default_exec_domain, \ |
| 57 | .flags = 0, \ |
| 58 | .cpu = 0, \ |
Peter Zijlstra | c99e6ef | 2009-07-10 14:57:56 +0200 | [diff] [blame] | 59 | .preempt_count = INIT_PREEMPT_COUNT, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | .addr_limit = KERNEL_DS, \ |
| 61 | .restart_block = { \ |
| 62 | .fn = do_no_restart_syscall, \ |
| 63 | }, \ |
| 64 | } |
| 65 | |
| 66 | #define init_thread_info (init_thread_union.thread_info) |
| 67 | |
WANG Cong | d496921 | 2011-08-03 16:21:12 -0700 | [diff] [blame] | 68 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | /* thread information allocation */ |
WANG Cong | d496921 | 2011-08-03 16:21:12 -0700 | [diff] [blame] | 70 | #define alloc_thread_info_node(tsk, node) \ |
| 71 | ((struct thread_info *) __get_free_pages(GFP_KERNEL, 1)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
| 74 | #endif /* !__ASSEMBLY__ */ |
| 75 | |
| 76 | /* |
| 77 | * thread information flags |
| 78 | * - these are process state flags that various assembly files may need to access |
| 79 | * - pending work-to-be-done flags are in LSW |
| 80 | * - other flags in MSW |
| 81 | */ |
| 82 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
Jesper Nilsson | 7b27552 | 2007-11-14 17:00:59 -0800 | [diff] [blame] | 83 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ |
| 84 | #define TIF_SIGPENDING 2 /* signal pending */ |
| 85 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ |
| 86 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ |
Andreas Dilger | 0ddc932 | 2010-05-14 11:13:27 +0200 | [diff] [blame] | 88 | #define TIF_MEMDIE 17 /* is terminating due to OOM killer */ |
Matt Helsley | 83224b0 | 2008-10-18 20:27:18 -0700 | [diff] [blame] | 89 | #define TIF_FREEZE 18 /* is freezing for suspend */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | |
| 91 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
Jesper Nilsson | 7b27552 | 2007-11-14 17:00:59 -0800 | [diff] [blame] | 92 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
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) |
Jesper Nilsson | 7b27552 | 2007-11-14 17:00:59 -0800 | [diff] [blame] | 95 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
Matt Helsley | 83224b0 | 2008-10-18 20:27:18 -0700 | [diff] [blame] | 97 | #define _TIF_FREEZE (1<<TIF_FREEZE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ |
| 100 | #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ |
| 101 | |
| 102 | #endif /* __KERNEL__ */ |
| 103 | |
| 104 | #endif /* _ASM_THREAD_INFO_H */ |