diff options
Diffstat (limited to 'arch/c6x/include/asm/thread_info.h')
-rw-r--r-- | arch/c6x/include/asm/thread_info.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/arch/c6x/include/asm/thread_info.h b/arch/c6x/include/asm/thread_info.h new file mode 100644 index 000000000000..fd99148cda9d --- /dev/null +++ b/arch/c6x/include/asm/thread_info.h | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | * Port on Texas Instruments TMS320C6x architecture | ||
3 | * | ||
4 | * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated | ||
5 | * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) | ||
6 | * | ||
7 | * Updated for 2.6.3x: Mark Salter <msalter@redhat.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #ifndef _ASM_C6X_THREAD_INFO_H | ||
14 | #define _ASM_C6X_THREAD_INFO_H | ||
15 | |||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <asm/page.h> | ||
19 | |||
20 | #ifdef CONFIG_4KSTACKS | ||
21 | #define THREAD_SIZE 4096 | ||
22 | #define THREAD_SHIFT 12 | ||
23 | #define THREAD_ORDER 0 | ||
24 | #else | ||
25 | #define THREAD_SIZE 8192 | ||
26 | #define THREAD_SHIFT 13 | ||
27 | #define THREAD_ORDER 1 | ||
28 | #endif | ||
29 | |||
30 | #define THREAD_START_SP (THREAD_SIZE - 8) | ||
31 | |||
32 | #ifndef __ASSEMBLY__ | ||
33 | |||
34 | typedef struct { | ||
35 | unsigned long seg; | ||
36 | } mm_segment_t; | ||
37 | |||
38 | /* | ||
39 | * low level task data. | ||
40 | */ | ||
41 | struct thread_info { | ||
42 | struct task_struct *task; /* main task structure */ | ||
43 | struct exec_domain *exec_domain; /* execution domain */ | ||
44 | unsigned long flags; /* low level flags */ | ||
45 | int cpu; /* cpu we're on */ | ||
46 | int preempt_count; /* 0 = preemptable, <0 = BUG */ | ||
47 | mm_segment_t addr_limit; /* thread address space */ | ||
48 | struct restart_block restart_block; | ||
49 | }; | ||
50 | |||
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 | #define INIT_THREAD_INFO(tsk) \ | ||
57 | { \ | ||
58 | .task = &tsk, \ | ||
59 | .exec_domain = &default_exec_domain, \ | ||
60 | .flags = 0, \ | ||
61 | .cpu = 0, \ | ||
62 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
63 | .addr_limit = KERNEL_DS, \ | ||
64 | .restart_block = { \ | ||
65 | .fn = do_no_restart_syscall, \ | ||
66 | }, \ | ||
67 | } | ||
68 | |||
69 | #define init_thread_info (init_thread_union.thread_info) | ||
70 | #define init_stack (init_thread_union.stack) | ||
71 | |||
72 | /* get the thread information struct of current task */ | ||
73 | static inline __attribute__((const)) | ||
74 | struct thread_info *current_thread_info(void) | ||
75 | { | ||
76 | struct thread_info *ti; | ||
77 | asm volatile (" clr .s2 B15,0,%1,%0\n" | ||
78 | : "=b" (ti) | ||
79 | : "Iu5" (THREAD_SHIFT - 1)); | ||
80 | return ti; | ||
81 | } | ||
82 | |||
83 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
84 | |||
85 | /* thread information allocation */ | ||
86 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
87 | #define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO) | ||
88 | #else | ||
89 | #define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK) | ||
90 | #endif | ||
91 | |||
92 | #define alloc_thread_info_node(tsk, node) \ | ||
93 | ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER)) | ||
94 | |||
95 | #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) | ||
96 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
97 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
98 | #endif /* __ASSEMBLY__ */ | ||
99 | |||
100 | #define PREEMPT_ACTIVE 0x10000000 | ||
101 | |||
102 | /* | ||
103 | * thread information flag bit numbers | ||
104 | * - pending work-to-be-done flags are in LSW | ||
105 | * - other flags in MSW | ||
106 | */ | ||
107 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
108 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
109 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
110 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
111 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | ||
112 | |||
113 | #define TIF_POLLING_NRFLAG 16 /* true if polling TIF_NEED_RESCHED */ | ||
114 | #define TIF_MEMDIE 17 /* OOM killer killed process */ | ||
115 | |||
116 | #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */ | ||
117 | #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */ | ||
118 | |||
119 | #endif /* __KERNEL__ */ | ||
120 | |||
121 | #endif /* _ASM_C6X_THREAD_INFO_H */ | ||