treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / c6x / include / asm / thread_info.h
blobf70382844b965bcfb04f893dc45226f9b7d1b27d
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Port on Texas Instruments TMS320C6x architecture
5 * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
6 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
8 * Updated for 2.6.3x: Mark Salter <msalter@redhat.com>
9 */
10 #ifndef _ASM_C6X_THREAD_INFO_H
11 #define _ASM_C6X_THREAD_INFO_H
13 #ifdef __KERNEL__
15 #include <asm/page.h>
17 #ifdef CONFIG_4KSTACKS
18 #define THREAD_SIZE 4096
19 #define THREAD_SHIFT 12
20 #define THREAD_SIZE_ORDER 0
21 #else
22 #define THREAD_SIZE 8192
23 #define THREAD_SHIFT 13
24 #define THREAD_SIZE_ORDER 1
25 #endif
27 #define THREAD_START_SP (THREAD_SIZE - 8)
29 #ifndef __ASSEMBLY__
31 typedef struct {
32 unsigned long seg;
33 } mm_segment_t;
36 * low level task data.
38 struct thread_info {
39 struct task_struct *task; /* main task structure */
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 */
47 * macros/functions for gaining access to the thread information structure
49 * preempt_count needs to be 1 initially, until the scheduler is functional.
51 #define INIT_THREAD_INFO(tsk) \
52 { \
53 .task = &tsk, \
54 .flags = 0, \
55 .cpu = 0, \
56 .preempt_count = INIT_PREEMPT_COUNT, \
57 .addr_limit = KERNEL_DS, \
60 /* get the thread information struct of current task */
61 static inline __attribute__((const))
62 struct thread_info *current_thread_info(void)
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;
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__ */
76 * thread information flag bit numbers
77 * - pending work-to-be-done flags are in LSW
78 * - other flags in MSW
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() */
86 #define TIF_MEMDIE 17 /* OOM killer killed process */
88 #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */
89 #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */
91 #endif /* __KERNEL__ */
93 #endif /* _ASM_C6X_THREAD_INFO_H */