1 /* thread_info.h: niosnommu low-level thread information
2 * adapted from the m68knommu
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 * Copyright (C) 2002 Microtronix Datacom
7 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
19 * NON INFRINGEMENT. See the GNU General Public License for more
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #ifndef _ASM_THREAD_INFO_H
29 #define _ASM_THREAD_INFO_H
38 * low level task data.
41 struct task_struct
*task
; /* main task structure */
42 struct exec_domain
*exec_domain
; /* execution domain */
43 unsigned long flags
; /* low level flags */
44 int cpu
; /* cpu we're on */
45 int preempt_count
; /* 0 => preemptable, <0 => BUG*/
46 struct restart_block restart_block
;
50 * macros/functions for gaining access to the thread information structure
52 #define INIT_THREAD_INFO(tsk) \
55 .exec_domain = &default_exec_domain, \
60 .fn = do_no_restart_syscall, \
64 #define init_thread_info (init_thread_union.thread_info)
65 #define init_stack (init_thread_union.stack)
68 /* how to get the thread information struct from C
69 usable only in supervisor mode */
70 static inline struct thread_info
*current_thread_info(void)
72 struct thread_info
*ti
;
77 : "r" (~(THREAD_SIZE
-1))
82 /* thread information allocation */
83 #define alloc_thread_info(tsk) ((struct thread_info *) \
84 __get_free_pages(GFP_KERNEL, 1))
85 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
86 #define put_thread_info(ti) put_task_struct((ti)->task)
88 #define PREEMPT_ACTIVE 0x4000000
91 * thread information flag bit numbers
93 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
94 #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
95 #define TIF_SIGPENDING 2 /* signal pending */
96 #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
97 #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
101 /* as above, but as bit values */
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_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
108 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
110 #else /* __ASSEMBLY__ */
112 /* how to get the thread information struct from ASM
113 usable only in supervisor mode */
114 .macro GET_THREAD_INFO reg
115 .if THREAD_SIZE
& 0xffff0000
116 andhi
\reg
, sp
, %hi(~(THREAD_SIZE
-1))
118 addi
\reg
, r0
, %lo(~(THREAD_SIZE
-1))
123 #endif /* __ASSEMBLY__ */
125 #endif /* __KERNEL__ */
127 #endif /* _ASM_THREAD_INFO_H */