108dbd0f8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 252f71024SRichard Kuo /* 352f71024SRichard Kuo * Thread support for the Hexagon architecture 452f71024SRichard Kuo * 5e1858b2aSRichard Kuo * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 652f71024SRichard Kuo */ 752f71024SRichard Kuo 852f71024SRichard Kuo #ifndef _ASM_THREAD_INFO_H 952f71024SRichard Kuo #define _ASM_THREAD_INFO_H 1052f71024SRichard Kuo 1152f71024SRichard Kuo #ifdef __KERNEL__ 1252f71024SRichard Kuo 1352f71024SRichard Kuo #ifndef __ASSEMBLY__ 1452f71024SRichard Kuo #include <asm/processor.h> 1552f71024SRichard Kuo #include <asm/registers.h> 1652f71024SRichard Kuo #include <asm/page.h> 1752f71024SRichard Kuo #endif 1852f71024SRichard Kuo 1952f71024SRichard Kuo #define THREAD_SHIFT 12 2052f71024SRichard Kuo #define THREAD_SIZE (1<<THREAD_SHIFT) 2152f71024SRichard Kuo #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 2252f71024SRichard Kuo 2352f71024SRichard Kuo #ifndef __ASSEMBLY__ 2452f71024SRichard Kuo 2552f71024SRichard Kuo /* 2652f71024SRichard Kuo * This is union'd with the "bottom" of the kernel stack. 2752f71024SRichard Kuo * It keeps track of thread info which is handy for routines 2852f71024SRichard Kuo * to access quickly. 2952f71024SRichard Kuo */ 3052f71024SRichard Kuo 3152f71024SRichard Kuo struct thread_info { 3252f71024SRichard Kuo struct task_struct *task; /* main task structure */ 3352f71024SRichard Kuo unsigned long flags; /* low level flags */ 3452f71024SRichard Kuo __u32 cpu; /* current cpu */ 3552f71024SRichard Kuo int preempt_count; /* 0=>preemptible,<0=>BUG */ 3652f71024SRichard Kuo /* 3752f71024SRichard Kuo * used for syscalls somehow; 3852f71024SRichard Kuo * seems to have a function pointer and four arguments 3952f71024SRichard Kuo */ 4052f71024SRichard Kuo /* Points to the current pt_regs frame */ 4152f71024SRichard Kuo struct pt_regs *regs; 4252f71024SRichard Kuo /* 4352f71024SRichard Kuo * saved kernel sp at switch_to time; 4452f71024SRichard Kuo * not sure if this is used (it's not in the VM model it seems; 4552f71024SRichard Kuo * see thread_struct) 4652f71024SRichard Kuo */ 4752f71024SRichard Kuo unsigned long sp; 4852f71024SRichard Kuo }; 4952f71024SRichard Kuo 5052f71024SRichard Kuo #else /* !__ASSEMBLY__ */ 5152f71024SRichard Kuo 5252f71024SRichard Kuo #include <asm/asm-offsets.h> 5352f71024SRichard Kuo 5452f71024SRichard Kuo #endif /* __ASSEMBLY__ */ 5552f71024SRichard Kuo 5652f71024SRichard Kuo #ifndef __ASSEMBLY__ 5752f71024SRichard Kuo 5852f71024SRichard Kuo #define INIT_THREAD_INFO(tsk) \ 5952f71024SRichard Kuo { \ 6052f71024SRichard Kuo .task = &tsk, \ 6152f71024SRichard Kuo .flags = 0, \ 6252f71024SRichard Kuo .cpu = 0, \ 6352f71024SRichard Kuo .preempt_count = 1, \ 6452f71024SRichard Kuo .sp = 0, \ 6552f71024SRichard Kuo .regs = NULL, \ 6652f71024SRichard Kuo } 6752f71024SRichard Kuo 6852f71024SRichard Kuo /* Tacky preprocessor trickery */ 6952f71024SRichard Kuo #define qqstr(s) qstr(s) 7052f71024SRichard Kuo #define qstr(s) #s 7152f71024SRichard Kuo #define QUOTED_THREADINFO_REG qqstr(THREADINFO_REG) 7252f71024SRichard Kuo 7352f71024SRichard Kuo register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG); 7452f71024SRichard Kuo #define current_thread_info() __current_thread_info 7552f71024SRichard Kuo 7652f71024SRichard Kuo #endif /* __ASSEMBLY__ */ 7752f71024SRichard Kuo 7852f71024SRichard Kuo /* 7952f71024SRichard Kuo * thread information flags 8052f71024SRichard Kuo * - these are process state flags that various assembly files 8152f71024SRichard Kuo * may need to access 8252f71024SRichard Kuo * - pending work-to-be-done flags are in LSW 8352f71024SRichard Kuo * - other flags in MSW 8452f71024SRichard Kuo */ 8552f71024SRichard Kuo 8652f71024SRichard Kuo #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 8752f71024SRichard Kuo #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ 8852f71024SRichard Kuo #define TIF_SIGPENDING 2 /* signal pending */ 8952f71024SRichard Kuo #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 9052f71024SRichard Kuo #define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */ 9152f71024SRichard Kuo #define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */ 92*aeec8193SJens Axboe #define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ 9352f71024SRichard Kuo /* true if poll_idle() is polling TIF_NEED_RESCHED */ 9452f71024SRichard Kuo #define TIF_MEMDIE 17 /* OOM killer killed process */ 9552f71024SRichard Kuo 9652f71024SRichard Kuo #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 9752f71024SRichard Kuo #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 9852f71024SRichard Kuo #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 9952f71024SRichard Kuo #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 10052f71024SRichard Kuo #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 101*aeec8193SJens Axboe #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 10252f71024SRichard Kuo 10352f71024SRichard Kuo /* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */ 10452f71024SRichard Kuo #define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE) 10552f71024SRichard Kuo 10652f71024SRichard Kuo /* work to do on any return to u-space */ 10752f71024SRichard Kuo #define _TIF_ALLWORK_MASK 0x0000FFFF 10852f71024SRichard Kuo 10952f71024SRichard Kuo #endif /* __KERNEL__ */ 11052f71024SRichard Kuo 11152f71024SRichard Kuo #endif 112