1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Thread support for the Hexagon architecture 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 6*4882a593Smuzhiyun */ 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun #ifndef _ASM_THREAD_INFO_H 9*4882a593Smuzhiyun #define _ASM_THREAD_INFO_H 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun #ifdef __KERNEL__ 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 14*4882a593Smuzhiyun #include <asm/processor.h> 15*4882a593Smuzhiyun #include <asm/registers.h> 16*4882a593Smuzhiyun #include <asm/page.h> 17*4882a593Smuzhiyun #endif 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun #define THREAD_SHIFT 12 20*4882a593Smuzhiyun #define THREAD_SIZE (1<<THREAD_SHIFT) 21*4882a593Smuzhiyun #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun typedef struct { 26*4882a593Smuzhiyun unsigned long seg; 27*4882a593Smuzhiyun } mm_segment_t; 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun /* 30*4882a593Smuzhiyun * This is union'd with the "bottom" of the kernel stack. 31*4882a593Smuzhiyun * It keeps track of thread info which is handy for routines 32*4882a593Smuzhiyun * to access quickly. 33*4882a593Smuzhiyun */ 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun struct thread_info { 36*4882a593Smuzhiyun struct task_struct *task; /* main task structure */ 37*4882a593Smuzhiyun unsigned long flags; /* low level flags */ 38*4882a593Smuzhiyun __u32 cpu; /* current cpu */ 39*4882a593Smuzhiyun int preempt_count; /* 0=>preemptible,<0=>BUG */ 40*4882a593Smuzhiyun mm_segment_t addr_limit; /* segmentation sux */ 41*4882a593Smuzhiyun /* 42*4882a593Smuzhiyun * used for syscalls somehow; 43*4882a593Smuzhiyun * seems to have a function pointer and four arguments 44*4882a593Smuzhiyun */ 45*4882a593Smuzhiyun /* Points to the current pt_regs frame */ 46*4882a593Smuzhiyun struct pt_regs *regs; 47*4882a593Smuzhiyun /* 48*4882a593Smuzhiyun * saved kernel sp at switch_to time; 49*4882a593Smuzhiyun * not sure if this is used (it's not in the VM model it seems; 50*4882a593Smuzhiyun * see thread_struct) 51*4882a593Smuzhiyun */ 52*4882a593Smuzhiyun unsigned long sp; 53*4882a593Smuzhiyun }; 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun #else /* !__ASSEMBLY__ */ 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun #include <asm/asm-offsets.h> 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */ 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun #define INIT_THREAD_INFO(tsk) \ 64*4882a593Smuzhiyun { \ 65*4882a593Smuzhiyun .task = &tsk, \ 66*4882a593Smuzhiyun .flags = 0, \ 67*4882a593Smuzhiyun .cpu = 0, \ 68*4882a593Smuzhiyun .preempt_count = 1, \ 69*4882a593Smuzhiyun .addr_limit = KERNEL_DS, \ 70*4882a593Smuzhiyun .sp = 0, \ 71*4882a593Smuzhiyun .regs = NULL, \ 72*4882a593Smuzhiyun } 73*4882a593Smuzhiyun 74*4882a593Smuzhiyun /* Tacky preprocessor trickery */ 75*4882a593Smuzhiyun #define qqstr(s) qstr(s) 76*4882a593Smuzhiyun #define qstr(s) #s 77*4882a593Smuzhiyun #define QUOTED_THREADINFO_REG qqstr(THREADINFO_REG) 78*4882a593Smuzhiyun 79*4882a593Smuzhiyun register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG); 80*4882a593Smuzhiyun #define current_thread_info() __current_thread_info 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */ 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun /* 85*4882a593Smuzhiyun * thread information flags 86*4882a593Smuzhiyun * - these are process state flags that various assembly files 87*4882a593Smuzhiyun * may need to access 88*4882a593Smuzhiyun * - pending work-to-be-done flags are in LSW 89*4882a593Smuzhiyun * - other flags in MSW 90*4882a593Smuzhiyun */ 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 93*4882a593Smuzhiyun #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ 94*4882a593Smuzhiyun #define TIF_SIGPENDING 2 /* signal pending */ 95*4882a593Smuzhiyun #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 96*4882a593Smuzhiyun #define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */ 97*4882a593Smuzhiyun #define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */ 98*4882a593Smuzhiyun #define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */ 99*4882a593Smuzhiyun /* true if poll_idle() is polling TIF_NEED_RESCHED */ 100*4882a593Smuzhiyun #define TIF_MEMDIE 17 /* OOM killer killed process */ 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 103*4882a593Smuzhiyun #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 104*4882a593Smuzhiyun #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 105*4882a593Smuzhiyun #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 106*4882a593Smuzhiyun #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 107*4882a593Smuzhiyun #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun /* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */ 110*4882a593Smuzhiyun #define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE) 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun /* work to do on any return to u-space */ 113*4882a593Smuzhiyun #define _TIF_ALLWORK_MASK 0x0000FFFF 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun #endif /* __KERNEL__ */ 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun #endif 118