b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. |
| 3 | |
| 4 | #ifndef _ASM_CSKY_THREAD_INFO_H |
| 5 | #define _ASM_CSKY_THREAD_INFO_H |
| 6 | |
| 7 | #ifndef __ASSEMBLY__ |
| 8 | |
| 9 | #include <linux/version.h> |
| 10 | #include <asm/types.h> |
| 11 | #include <asm/page.h> |
| 12 | #include <asm/processor.h> |
| 13 | #include <abi/switch_context.h> |
| 14 | |
| 15 | struct thread_info { |
| 16 | struct task_struct *task; |
| 17 | void *dump_exec_domain; |
| 18 | unsigned long flags; |
| 19 | int preempt_count; |
| 20 | unsigned long tp_value; |
| 21 | mm_segment_t addr_limit; |
| 22 | struct restart_block restart_block; |
| 23 | struct pt_regs *regs; |
| 24 | unsigned int cpu; |
| 25 | }; |
| 26 | |
| 27 | #define INIT_THREAD_INFO(tsk) \ |
| 28 | { \ |
| 29 | .task = &tsk, \ |
| 30 | .preempt_count = INIT_PREEMPT_COUNT, \ |
| 31 | .addr_limit = KERNEL_DS, \ |
| 32 | .cpu = 0, \ |
| 33 | .restart_block = { \ |
| 34 | .fn = do_no_restart_syscall, \ |
| 35 | }, \ |
| 36 | } |
| 37 | |
| 38 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
| 39 | |
| 40 | #define thread_saved_fp(tsk) \ |
| 41 | ((unsigned long)(((struct switch_stack *)(tsk->thread.ksp))->r8)) |
| 42 | |
| 43 | static inline struct thread_info *current_thread_info(void) |
| 44 | { |
| 45 | unsigned long sp; |
| 46 | |
| 47 | asm volatile("mov %0, sp\n":"=r"(sp)); |
| 48 | |
| 49 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); |
| 50 | } |
| 51 | |
| 52 | #endif /* !__ASSEMBLY__ */ |
| 53 | |
| 54 | #define TIF_SIGPENDING 0 /* signal pending */ |
| 55 | #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */ |
| 56 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
| 57 | #define TIF_SYSCALL_TRACE 3 /* syscall trace active */ |
| 58 | #define TIF_SYSCALL_TRACEPOINT 4 /* syscall tracepoint instrumentation */ |
| 59 | #define TIF_SYSCALL_AUDIT 5 /* syscall auditing */ |
| 60 | #define TIF_POLLING_NRFLAG 16 /* poll_idle() is TIF_NEED_RESCHED */ |
| 61 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
| 62 | #define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */ |
| 63 | #define TIF_SECCOMP 21 /* secure computing */ |
| 64 | |
| 65 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
| 66 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
| 67 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
| 68 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
| 69 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) |
| 70 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) |
| 71 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) |
| 72 | #define _TIF_MEMDIE (1 << TIF_MEMDIE) |
| 73 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) |
| 74 | #define _TIF_SECCOMP (1 << TIF_SECCOMP) |
| 75 | |
| 76 | #endif /* _ASM_CSKY_THREAD_INFO_H */ |