Commit | Line | Data |
---|---|---|
d2912cb1 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
687b12ba AJ |
2 | /* |
3 | * Port on Texas Instruments TMS320C6x architecture | |
4 | * | |
5 | * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated | |
6 | * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com) | |
7 | * | |
8 | * Updated for 2.6.3x: Mark Salter <msalter@redhat.com> | |
687b12ba AJ |
9 | */ |
10 | #ifndef _ASM_C6X_THREAD_INFO_H | |
11 | #define _ASM_C6X_THREAD_INFO_H | |
12 | ||
13 | #ifdef __KERNEL__ | |
14 | ||
15 | #include <asm/page.h> | |
16 | ||
17 | #ifdef CONFIG_4KSTACKS | |
18 | #define THREAD_SIZE 4096 | |
19 | #define THREAD_SHIFT 12 | |
7b8fe057 | 20 | #define THREAD_SIZE_ORDER 0 |
687b12ba AJ |
21 | #else |
22 | #define THREAD_SIZE 8192 | |
23 | #define THREAD_SHIFT 13 | |
7b8fe057 | 24 | #define THREAD_SIZE_ORDER 1 |
687b12ba AJ |
25 | #endif |
26 | ||
27 | #define THREAD_START_SP (THREAD_SIZE - 8) | |
28 | ||
29 | #ifndef __ASSEMBLY__ | |
30 | ||
31 | typedef struct { | |
32 | unsigned long seg; | |
33 | } mm_segment_t; | |
34 | ||
35 | /* | |
36 | * low level task data. | |
37 | */ | |
38 | struct thread_info { | |
39 | struct task_struct *task; /* main task structure */ | |
687b12ba AJ |
40 | unsigned long flags; /* low level flags */ |
41 | int cpu; /* cpu we're on */ | |
42 | int preempt_count; /* 0 = preemptable, <0 = BUG */ | |
43 | mm_segment_t addr_limit; /* thread address space */ | |
687b12ba AJ |
44 | }; |
45 | ||
46 | /* | |
47 | * macros/functions for gaining access to the thread information structure | |
48 | * | |
49 | * preempt_count needs to be 1 initially, until the scheduler is functional. | |
50 | */ | |
51 | #define INIT_THREAD_INFO(tsk) \ | |
52 | { \ | |
53 | .task = &tsk, \ | |
687b12ba AJ |
54 | .flags = 0, \ |
55 | .cpu = 0, \ | |
56 | .preempt_count = INIT_PREEMPT_COUNT, \ | |
57 | .addr_limit = KERNEL_DS, \ | |
687b12ba AJ |
58 | } |
59 | ||
687b12ba AJ |
60 | /* get the thread information struct of current task */ |
61 | static inline __attribute__((const)) | |
62 | struct thread_info *current_thread_info(void) | |
63 | { | |
64 | struct thread_info *ti; | |
65 | asm volatile (" clr .s2 B15,0,%1,%0\n" | |
66 | : "=b" (ti) | |
67 | : "Iu5" (THREAD_SHIFT - 1)); | |
68 | return ti; | |
69 | } | |
70 | ||
687b12ba AJ |
71 | #define get_thread_info(ti) get_task_struct((ti)->task) |
72 | #define put_thread_info(ti) put_task_struct((ti)->task) | |
73 | #endif /* __ASSEMBLY__ */ | |
74 | ||
687b12ba AJ |
75 | /* |
76 | * thread information flag bit numbers | |
77 | * - pending work-to-be-done flags are in LSW | |
78 | * - other flags in MSW | |
79 | */ | |
80 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | |
81 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | |
82 | #define TIF_SIGPENDING 2 /* signal pending */ | |
83 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | |
84 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | |
6d665a4d | 85 | #define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */ |
687b12ba | 86 | |
687b12ba AJ |
87 | #define TIF_MEMDIE 17 /* OOM killer killed process */ |
88 | ||
89 | #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */ | |
90 | #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */ | |
91 | ||
92 | #endif /* __KERNEL__ */ | |
93 | ||
94 | #endif /* _ASM_C6X_THREAD_INFO_H */ |