Commit | Line | Data |
---|---|---|
1394f032 | 1 | /* |
3750411f | 2 | * Copyright 2004-2010 Analog Devices Inc. |
1394f032 | 3 | * |
96f1050d | 4 | * Licensed under the GPL-2 or later. |
1394f032 BW |
5 | */ |
6 | ||
7 | #ifndef _ASM_THREAD_INFO_H | |
8 | #define _ASM_THREAD_INFO_H | |
9 | ||
10 | #include <asm/page.h> | |
11 | #include <asm/entry.h> | |
12 | #include <asm/l1layout.h> | |
13 | #include <linux/compiler.h> | |
14 | ||
15 | #ifdef __KERNEL__ | |
16 | ||
17 | /* Thread Align Mask to reach to the top of the stack | |
18 | * for any process | |
19 | */ | |
3750411f | 20 | #define ALIGN_PAGE_MASK 0xffffe000 |
1394f032 | 21 | |
12a79911 MF |
22 | /* |
23 | * Size of kernel stack for each process. This must be a power of 2... | |
24 | */ | |
b69c49b7 | 25 | #define THREAD_SIZE_ORDER 1 |
12a79911 | 26 | #define THREAD_SIZE 8192 /* 2 pages */ |
a45d575f | 27 | #define STACK_WARN (THREAD_SIZE/8) |
12a79911 | 28 | |
1394f032 BW |
29 | #ifndef __ASSEMBLY__ |
30 | ||
31 | typedef unsigned long mm_segment_t; | |
32 | ||
33 | /* | |
34 | * low level task data. | |
35 | * If you change this, change the TI_* offsets below to match. | |
36 | */ | |
37 | ||
38 | struct thread_info { | |
39 | struct task_struct *task; /* main task structure */ | |
40 | struct exec_domain *exec_domain; /* execution domain */ | |
41 | unsigned long flags; /* low level flags */ | |
42 | int cpu; /* cpu we're on */ | |
43 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | |
44 | mm_segment_t addr_limit; /* address limit */ | |
cc92b870 | 45 | #ifndef CONFIG_SMP |
1394f032 | 46 | struct l1_scratch_task_info l1_task_info; |
cc92b870 | 47 | #endif |
1394f032 BW |
48 | }; |
49 | ||
50 | /* | |
51 | * macros/functions for gaining access to the thread information structure | |
52 | */ | |
53 | #define INIT_THREAD_INFO(tsk) \ | |
54 | { \ | |
55 | .task = &tsk, \ | |
56 | .exec_domain = &default_exec_domain, \ | |
57 | .flags = 0, \ | |
58 | .cpu = 0, \ | |
3750411f | 59 | .preempt_count = INIT_PREEMPT_COUNT, \ |
1394f032 BW |
60 | } |
61 | #define init_thread_info (init_thread_union.thread_info) | |
62 | #define init_stack (init_thread_union.stack) | |
63 | ||
18628e43 RD |
64 | /* Given a task stack pointer, you can find its corresponding |
65 | * thread_info structure just by masking it to the THREAD_SIZE | |
66 | * boundary (currently 8K as you can see above). | |
1394f032 | 67 | */ |
18628e43 | 68 | __attribute_const__ |
1394f032 BW |
69 | static inline struct thread_info *current_thread_info(void) |
70 | { | |
71 | struct thread_info *ti; | |
3750411f | 72 | __asm__("%0 = sp;" : "=da"(ti)); |
12a79911 | 73 | return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1)); |
1394f032 BW |
74 | } |
75 | ||
1394f032 BW |
76 | #endif /* __ASSEMBLY__ */ |
77 | ||
1394f032 BW |
78 | /* |
79 | * thread information flag bit numbers | |
80 | */ | |
81 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | |
a583f1b5 SE |
82 | #define TIF_SIGPENDING 1 /* signal pending */ |
83 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | |
0ddc9324 | 84 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ |
a583f1b5 | 85 | #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ |
3750411f MF |
86 | #define TIF_IRQ_SYNC 7 /* sync pipeline stage */ |
87 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | |
600482c1 | 88 | #define TIF_SINGLESTEP 9 |
1394f032 BW |
89 | |
90 | /* as above, but as bit values */ | |
91 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | |
1394f032 BW |
92 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
93 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | |
3750411f MF |
94 | #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC) |
95 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | |
600482c1 | 96 | #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP) |
1394f032 BW |
97 | |
98 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | |
99 | ||
100 | #endif /* __KERNEL__ */ | |
101 | ||
102 | #endif /* _ASM_THREAD_INFO_H */ |