]>
Commit | Line | Data |
---|---|---|
687b12ba AJ |
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 | |
7b8fe057 | 23 | #define THREAD_SIZE_ORDER 0 |
687b12ba AJ |
24 | #else |
25 | #define THREAD_SIZE 8192 | |
26 | #define THREAD_SHIFT 13 | |
7b8fe057 | 27 | #define THREAD_SIZE_ORDER 1 |
687b12ba AJ |
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 */ | |
687b12ba AJ |
48 | }; |
49 | ||
50 | /* | |
51 | * macros/functions for gaining access to the thread information structure | |
52 | * | |
53 | * preempt_count needs to be 1 initially, until the scheduler is functional. | |
54 | */ | |
55 | #define INIT_THREAD_INFO(tsk) \ | |
56 | { \ | |
57 | .task = &tsk, \ | |
58 | .exec_domain = &default_exec_domain, \ | |
59 | .flags = 0, \ | |
60 | .cpu = 0, \ | |
61 | .preempt_count = INIT_PREEMPT_COUNT, \ | |
62 | .addr_limit = KERNEL_DS, \ | |
687b12ba AJ |
63 | } |
64 | ||
65 | #define init_thread_info (init_thread_union.thread_info) | |
66 | #define init_stack (init_thread_union.stack) | |
67 | ||
68 | /* get the thread information struct of current task */ | |
69 | static inline __attribute__((const)) | |
70 | struct thread_info *current_thread_info(void) | |
71 | { | |
72 | struct thread_info *ti; | |
73 | asm volatile (" clr .s2 B15,0,%1,%0\n" | |
74 | : "=b" (ti) | |
75 | : "Iu5" (THREAD_SHIFT - 1)); | |
76 | return ti; | |
77 | } | |
78 | ||
687b12ba AJ |
79 | #define get_thread_info(ti) get_task_struct((ti)->task) |
80 | #define put_thread_info(ti) put_task_struct((ti)->task) | |
81 | #endif /* __ASSEMBLY__ */ | |
82 | ||
687b12ba AJ |
83 | /* |
84 | * thread information flag bit numbers | |
85 | * - pending work-to-be-done flags are in LSW | |
86 | * - other flags in MSW | |
87 | */ | |
88 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | |
89 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | |
90 | #define TIF_SIGPENDING 2 /* signal pending */ | |
91 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | |
92 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | |
93 | ||
687b12ba AJ |
94 | #define TIF_MEMDIE 17 /* OOM killer killed process */ |
95 | ||
96 | #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */ | |
97 | #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */ | |
98 | ||
99 | #endif /* __KERNEL__ */ | |
100 | ||
101 | #endif /* _ASM_C6X_THREAD_INFO_H */ |