2 * arch/ubicom32/include/asm/thread_info.h
3 * Ubicom32 architecture low-level thread information.
5 * (C) Copyright 2009, Ubicom, Inc.
6 * Adapted from the i386 and PPC versions by Greg Ungerer (gerg@snapgear.com)
7 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
8 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
10 * This file is part of the Ubicom32 Linux Kernel Port.
12 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
13 * it and/or modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 2 of the
15 * License, or (at your option) any later version.
17 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
18 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
19 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
20 * the GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with the Ubicom32 Linux Kernel Port. If not,
24 * see <http://www.gnu.org/licenses/>.
26 * Ubicom32 implementation derived from (with many thanks):
32 #ifndef _ASM_UBICOM32_THREAD_INFO_H
33 #define _ASM_UBICOM32_THREAD_INFO_H
38 * Size of kernel stack for each process. This must be a power of 2...
40 #ifdef CONFIG_4KSTACKS
41 #define THREAD_SIZE_ORDER (0)
43 #define THREAD_SIZE_ORDER (1)
47 * for asm files, THREAD_SIZE is now generated by asm-offsets.c
49 #define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)
56 * low level task data.
59 struct task_struct
*task
; /* main task structure */
60 struct exec_domain
*exec_domain
; /* execution domain */
61 unsigned long flags
; /* low level flags */
62 int cpu
; /* cpu we're on */
63 int preempt_count
; /* 0 => preemptable, <0 => BUG */
64 int interrupt_nesting
; /* Interrupt nesting level. */
65 struct restart_block restart_block
;
69 * macros/functions for gaining access to the thread information structure
71 #define INIT_THREAD_INFO(tsk) \
74 .exec_domain = &default_exec_domain, \
77 .interrupt_nesting = 0, \
79 .fn = do_no_restart_syscall, \
83 #define init_thread_info (init_thread_union.thread_info)
84 #define init_stack (init_thread_union.stack)
87 /* how to get the thread information struct from C */
88 static inline struct thread_info
*current_thread_info(void)
90 struct thread_info
*ti
;
93 "and.4 %0, sp, %1\n\t"
95 : "d" (~(THREAD_SIZE
-1))
102 #define STACK_WARN (THREAD_SIZE / 8)
104 #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 1
106 /* thread information allocation */
107 #define alloc_thread_info(tsk) ((struct thread_info *) \
108 __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
109 #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER)
110 #endif /* __ASSEMBLY__ */
112 #define PREEMPT_ACTIVE 0x4000000
115 * thread information flag bit numbers
117 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
118 #define TIF_SIGPENDING 1 /* signal pending */
119 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
120 #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
124 /* as above, but as bit values */
125 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
126 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
127 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
128 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
130 #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
132 #endif /* __KERNEL__ */
134 #endif /* _ASM_UBICOM32_THREAD_INFO_H */