blob: 4ead1b40d2d743dab304678f2f872762447477ed [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
14#ifndef __ASSEMBLY__
15#include <asm/types.h>
16#include <asm/processor.h>
Jesper Nilsson556dcee2008-10-21 17:45:58 +020017#include <arch/thread_info.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#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__
29struct thread_info {
30 struct task_struct *task; /* main task structure */
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 unsigned long flags; /* low level flags */
32 __u32 cpu; /* current CPU */
Jesper Juhldcd497f2005-06-23 00:09:07 -070033 int preempt_count; /* 0 => preemptable, <0 => BUG */
Jesper Nilsson7b275522007-11-14 17:00:59 -080034 __u32 tls; /* TLS for this thread */
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36 mm_segment_t addr_limit; /* thread address space:
37 0-0xBFFFFFFF for user-thead
38 0-0xFFFFFFFF for kernel-thread
39 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 __u8 supervisor_stack[0];
41};
42
43#endif
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045/*
46 * macros/functions for gaining access to the thread information structure
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 */
48#ifndef __ASSEMBLY__
49#define INIT_THREAD_INFO(tsk) \
50{ \
51 .task = &tsk, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 .flags = 0, \
53 .cpu = 0, \
Peter Zijlstrac99e6ef2009-07-10 14:57:56 +020054 .preempt_count = INIT_PREEMPT_COUNT, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 .addr_limit = KERNEL_DS, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070056}
57
58#define init_thread_info (init_thread_union.thread_info)
59
Linus Torvalds1da177e2005-04-16 15:20:36 -070060#endif /* !__ASSEMBLY__ */
61
62/*
63 * thread information flags
64 * - these are process state flags that various assembly files may need to access
65 * - pending work-to-be-done flags are in LSW
66 * - other flags in MSW
67 */
68#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
Jesper Nilsson7b275522007-11-14 17:00:59 -080069#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
70#define TIF_SIGPENDING 2 /* signal pending */
71#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
72#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
Andreas Dilger0ddc9322010-05-14 11:13:27 +020073#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
75#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
Jesper Nilsson7b275522007-11-14 17:00:59 -080076#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
Linus Torvalds1da177e2005-04-16 15:20:36 -070077#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
78#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
81#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
82
83#endif /* __KERNEL__ */
84
85#endif /* _ASM_THREAD_INFO_H */