Greentime Hu | a15e9ff | 2017-10-24 15:47:50 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | // Copyright (C) 2005-2017 Andes Technology Corporation |
| 3 | |
| 4 | #ifndef __ASM_NDS32_THREAD_INFO_H |
| 5 | #define __ASM_NDS32_THREAD_INFO_H |
| 6 | |
| 7 | #ifdef __KERNEL__ |
| 8 | |
| 9 | #define THREAD_SIZE_ORDER (1) |
| 10 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
| 11 | |
| 12 | #ifndef __ASSEMBLY__ |
| 13 | |
| 14 | struct task_struct; |
| 15 | |
| 16 | #include <asm/ptrace.h> |
| 17 | #include <asm/types.h> |
| 18 | |
| 19 | typedef unsigned long mm_segment_t; |
| 20 | |
| 21 | /* |
| 22 | * low level task data that entry.S needs immediate access to. |
| 23 | * __switch_to() assumes cpu_context follows immediately after cpu_domain. |
| 24 | */ |
| 25 | struct thread_info { |
| 26 | unsigned long flags; /* low level flags */ |
| 27 | __s32 preempt_count; /* 0 => preemptable, <0 => bug */ |
| 28 | mm_segment_t addr_limit; /* address limit */ |
| 29 | }; |
| 30 | #define INIT_THREAD_INFO(tsk) \ |
| 31 | { \ |
| 32 | .preempt_count = INIT_PREEMPT_COUNT, \ |
| 33 | .addr_limit = KERNEL_DS, \ |
| 34 | } |
| 35 | #define thread_saved_pc(tsk) ((unsigned long)(tsk->thread.cpu_context.pc)) |
| 36 | #define thread_saved_fp(tsk) ((unsigned long)(tsk->thread.cpu_context.fp)) |
| 37 | #endif |
| 38 | |
| 39 | /* |
| 40 | * thread information flags: |
| 41 | * TIF_SYSCALL_TRACE - syscall trace active |
| 42 | * TIF_SIGPENDING - signal pending |
| 43 | * TIF_NEED_RESCHED - rescheduling necessary |
| 44 | * TIF_NOTIFY_RESUME - callback before returning to user |
| 45 | * TIF_USEDFPU - FPU was used by this task this quantum (SMP) |
| 46 | * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED |
| 47 | */ |
| 48 | #define TIF_SIGPENDING 1 |
| 49 | #define TIF_NEED_RESCHED 2 |
| 50 | #define TIF_SINGLESTEP 3 |
| 51 | #define TIF_NOTIFY_RESUME 4 /* callback before returning to user */ |
| 52 | #define TIF_SYSCALL_TRACE 8 |
| 53 | #define TIF_USEDFPU 16 |
| 54 | #define TIF_POLLING_NRFLAG 17 |
| 55 | #define TIF_MEMDIE 18 |
| 56 | #define TIF_FREEZE 19 |
| 57 | #define TIF_RESTORE_SIGMASK 20 |
| 58 | |
| 59 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
| 60 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
| 61 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
| 62 | #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) |
| 63 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
| 64 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
| 65 | #define _TIF_FREEZE (1 << TIF_FREEZE) |
| 66 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) |
| 67 | |
| 68 | /* |
| 69 | * Change these and you break ASM code in entry-common.S |
| 70 | */ |
| 71 | #define _TIF_WORK_MASK 0x000000ff |
| 72 | #define _TIF_WORK_SYSCALL_ENTRY (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP) |
| 73 | #define _TIF_WORK_SYSCALL_LEAVE (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP) |
| 74 | |
| 75 | #endif /* __KERNEL__ */ |
| 76 | #endif /* __ASM_NDS32_THREAD_INFO_H */ |