1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _ASM_M68K_THREAD_INFO_H 3*4882a593Smuzhiyun #define _ASM_M68K_THREAD_INFO_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <asm/types.h> 6*4882a593Smuzhiyun #include <asm/page.h> 7*4882a593Smuzhiyun #include <asm/segment.h> 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun /* 10*4882a593Smuzhiyun * On machines with 4k pages we default to an 8k thread size, though we 11*4882a593Smuzhiyun * allow a 4k with config option. Any other machine page size then 12*4882a593Smuzhiyun * the thread size must match the page size (which is 8k and larger here). 13*4882a593Smuzhiyun */ 14*4882a593Smuzhiyun #if PAGE_SHIFT < 13 15*4882a593Smuzhiyun #ifdef CONFIG_4KSTACKS 16*4882a593Smuzhiyun #define THREAD_SIZE 4096 17*4882a593Smuzhiyun #else 18*4882a593Smuzhiyun #define THREAD_SIZE 8192 19*4882a593Smuzhiyun #endif 20*4882a593Smuzhiyun #else 21*4882a593Smuzhiyun #define THREAD_SIZE PAGE_SIZE 22*4882a593Smuzhiyun #endif 23*4882a593Smuzhiyun #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun struct thread_info { 28*4882a593Smuzhiyun struct task_struct *task; /* main task structure */ 29*4882a593Smuzhiyun unsigned long flags; 30*4882a593Smuzhiyun mm_segment_t addr_limit; /* thread address space */ 31*4882a593Smuzhiyun int preempt_count; /* 0 => preemptable, <0 => BUG */ 32*4882a593Smuzhiyun __u32 cpu; /* should always be 0 on m68k */ 33*4882a593Smuzhiyun unsigned long tp_value; /* thread pointer */ 34*4882a593Smuzhiyun }; 35*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */ 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun #define INIT_THREAD_INFO(tsk) \ 38*4882a593Smuzhiyun { \ 39*4882a593Smuzhiyun .task = &tsk, \ 40*4882a593Smuzhiyun .addr_limit = KERNEL_DS, \ 41*4882a593Smuzhiyun .preempt_count = INIT_PREEMPT_COUNT, \ 42*4882a593Smuzhiyun } 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun #ifndef __ASSEMBLY__ 45*4882a593Smuzhiyun /* how to get the thread information struct from C */ current_thread_info(void)46*4882a593Smuzhiyunstatic inline struct thread_info *current_thread_info(void) 47*4882a593Smuzhiyun { 48*4882a593Smuzhiyun struct thread_info *ti; 49*4882a593Smuzhiyun __asm__( 50*4882a593Smuzhiyun "move.l %%sp, %0 \n\t" 51*4882a593Smuzhiyun "and.l %1, %0" 52*4882a593Smuzhiyun : "=&d"(ti) 53*4882a593Smuzhiyun : "di" (~(THREAD_SIZE-1)) 54*4882a593Smuzhiyun ); 55*4882a593Smuzhiyun return ti; 56*4882a593Smuzhiyun } 57*4882a593Smuzhiyun #endif 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun /* entry.S relies on these definitions! 60*4882a593Smuzhiyun * bits 0-7 are tested at every exception exit 61*4882a593Smuzhiyun * bits 8-15 are also tested at syscall exit 62*4882a593Smuzhiyun */ 63*4882a593Smuzhiyun #define TIF_NOTIFY_SIGNAL 4 64*4882a593Smuzhiyun #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ 65*4882a593Smuzhiyun #define TIF_SIGPENDING 6 /* signal pending */ 66*4882a593Smuzhiyun #define TIF_NEED_RESCHED 7 /* rescheduling necessary */ 67*4882a593Smuzhiyun #define TIF_DELAYED_TRACE 14 /* single step a syscall */ 68*4882a593Smuzhiyun #define TIF_SYSCALL_TRACE 15 /* syscall trace active */ 69*4882a593Smuzhiyun #define TIF_MEMDIE 16 /* is terminating due to OOM killer */ 70*4882a593Smuzhiyun #define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal */ 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 73*4882a593Smuzhiyun #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 74*4882a593Smuzhiyun #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 75*4882a593Smuzhiyun #define _TIF_DELAYED_TRACE (1 << TIF_DELAYED_TRACE) 76*4882a593Smuzhiyun #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 77*4882a593Smuzhiyun #define _TIF_MEMDIE (1 << TIF_MEMDIE) 78*4882a593Smuzhiyun #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun #endif /* _ASM_M68K_THREAD_INFO_H */ 81