blob: 7efe1000f99d23e18b0825d7b8f4c7ebc52df53d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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
FUJITA Tomonorib69c49b2008-07-25 01:45:40 -070014#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
15
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#ifndef __ASSEMBLY__
17#include <asm/types.h>
18#include <asm/processor.h>
19#include <asm/arch/thread_info.h>
20#include <asm/segment.h>
21#endif
22
23
24/*
25 * low level task data that entry.S needs immediate access to
26 * - this struct should fit entirely inside of one cache line
27 * - this struct shares the supervisor stack pages
28 * - if the contents of this structure are changed, the assembly constants must also be changed
29 */
30#ifndef __ASSEMBLY__
31struct thread_info {
32 struct task_struct *task; /* main task structure */
33 struct exec_domain *exec_domain; /* execution domain */
34 unsigned long flags; /* low level flags */
35 __u32 cpu; /* current CPU */
Jesper Juhldcd497f2005-06-23 00:09:07 -070036 int preempt_count; /* 0 => preemptable, <0 => BUG */
Jesper Nilsson7b275522007-11-14 17:00:59 -080037 __u32 tls; /* TLS for this thread */
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39 mm_segment_t addr_limit; /* thread address space:
40 0-0xBFFFFFFF for user-thead
41 0-0xFFFFFFFF for kernel-thread
42 */
43 struct restart_block restart_block;
44 __u8 supervisor_stack[0];
45};
46
47#endif
48
Mikael Starvik5d01e6c2005-07-27 11:44:43 -070049#define PREEMPT_ACTIVE 0x10000000
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51/*
52 * macros/functions for gaining access to the thread information structure
53 *
54 * preempt_count needs to be 1 initially, until the scheduler is functional.
55 */
56#ifndef __ASSEMBLY__
57#define INIT_THREAD_INFO(tsk) \
58{ \
59 .task = &tsk, \
60 .exec_domain = &default_exec_domain, \
61 .flags = 0, \
62 .cpu = 0, \
63 .preempt_count = 1, \
64 .addr_limit = KERNEL_DS, \
65 .restart_block = { \
66 .fn = do_no_restart_syscall, \
67 }, \
68}
69
70#define init_thread_info (init_thread_union.thread_info)
71
72/* thread information allocation */
73#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
74#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
76#endif /* !__ASSEMBLY__ */
77
78/*
79 * thread information flags
80 * - these are process state flags that various assembly files may need to access
81 * - pending work-to-be-done flags are in LSW
82 * - other flags in MSW
83 */
84#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
Jesper Nilsson7b275522007-11-14 17:00:59 -080085#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
86#define TIF_SIGPENDING 2 /* signal pending */
87#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
88#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
Linus Torvalds1da177e2005-04-16 15:20:36 -070089#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
90#define TIF_MEMDIE 17
91
92#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
Jesper Nilsson7b275522007-11-14 17:00:59 -080093#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
95#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
Jesper Nilsson7b275522007-11-14 17:00:59 -080096#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
Linus Torvalds1da177e2005-04-16 15:20:36 -070097#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
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 */