2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
9 * No need for ARC specific thread_info allocator (kmalloc/free). This is
10 * anyways one page allocation, thus slab alloc can be short-circuited and
11 * the generic version (get_free_page) would be loads better.
13 * Sameer Dhavale: Codito Technologies 2004
16 #ifndef _ASM_THREAD_INFO_H
17 #define _ASM_THREAD_INFO_H
23 #ifdef CONFIG_16KSTACKS
24 #define THREAD_SIZE_ORDER 1
26 #define THREAD_SIZE_ORDER 0
29 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
33 #include <linux/thread_info.h>
34 #include <asm/segment.h>
37 * low level task data that entry.S needs immediate access to
38 * - this struct should fit entirely inside of one cache line
39 * - this struct shares the supervisor stack pages
40 * - if the contents of this structure are changed, the assembly constants
41 * must also be changed
44 unsigned long flags
; /* low level flags */
45 int preempt_count
; /* 0 => preemptable, <0 => BUG */
46 struct task_struct
*task
; /* main task structure */
47 mm_segment_t addr_limit
; /* thread address space */
48 struct exec_domain
*exec_domain
;/* execution domain */
49 __u32 cpu
; /* current CPU */
50 unsigned long thr_ptr
; /* TLS ptr */
51 struct restart_block restart_block
;
55 * macros/functions for gaining access to the thread information structure
57 * preempt_count needs to be 1 initially, until the scheduler is functional.
59 #define INIT_THREAD_INFO(tsk) \
62 .exec_domain = &default_exec_domain, \
65 .preempt_count = INIT_PREEMPT_COUNT, \
66 .addr_limit = KERNEL_DS, \
68 .fn = do_no_restart_syscall, \
72 #define init_thread_info (init_thread_union.thread_info)
73 #define init_stack (init_thread_union.stack)
75 static inline __attribute_const__
struct thread_info
*current_thread_info(void)
77 register unsigned long sp
asm("sp");
78 return (struct thread_info
*)(sp
& ~(THREAD_SIZE
- 1));
81 #endif /* !__ASSEMBLY__ */
83 #define PREEMPT_ACTIVE 0x10000000
86 * thread information flags
87 * - these are process state flags that various assembly files may need to
89 * - pending work-to-be-done flags are in LSW
90 * - other flags in MSW
92 #define TIF_RESTORE_SIGMASK 0 /* restore sig mask in do_signal() */
93 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
94 #define TIF_SIGPENDING 2 /* signal pending */
95 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
96 #define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
97 #define TIF_SYSCALL_TRACE 15 /* syscall trace active */
99 /* true if poll_idle() is polling TIF_NEED_RESCHED */
100 #define TIF_MEMDIE 16
102 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
103 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
104 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
105 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
106 #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
107 #define _TIF_MEMDIE (1<<TIF_MEMDIE)
109 /* work to do on interrupt/exception return */
110 #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
114 * _TIF_ALLWORK_MASK includes SYSCALL_TRACE, but we don't need it.
115 * SYSCALL_TRACE is anways seperately/unconditionally tested right after a
116 * syscall, so all that reamins to be tested is _TIF_WORK_MASK
119 #endif /* __KERNEL__ */
121 #endif /* _ASM_THREAD_INFO_H */