18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_M68K_THREAD_INFO_H 38c2ecf20Sopenharmony_ci#define _ASM_M68K_THREAD_INFO_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <asm/types.h> 68c2ecf20Sopenharmony_ci#include <asm/page.h> 78c2ecf20Sopenharmony_ci#include <asm/segment.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci/* 108c2ecf20Sopenharmony_ci * On machines with 4k pages we default to an 8k thread size, though we 118c2ecf20Sopenharmony_ci * allow a 4k with config option. Any other machine page size then 128c2ecf20Sopenharmony_ci * the thread size must match the page size (which is 8k and larger here). 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci#if PAGE_SHIFT < 13 158c2ecf20Sopenharmony_ci#ifdef CONFIG_4KSTACKS 168c2ecf20Sopenharmony_ci#define THREAD_SIZE 4096 178c2ecf20Sopenharmony_ci#else 188c2ecf20Sopenharmony_ci#define THREAD_SIZE 8192 198c2ecf20Sopenharmony_ci#endif 208c2ecf20Sopenharmony_ci#else 218c2ecf20Sopenharmony_ci#define THREAD_SIZE PAGE_SIZE 228c2ecf20Sopenharmony_ci#endif 238c2ecf20Sopenharmony_ci#define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistruct thread_info { 288c2ecf20Sopenharmony_ci struct task_struct *task; /* main task structure */ 298c2ecf20Sopenharmony_ci unsigned long flags; 308c2ecf20Sopenharmony_ci mm_segment_t addr_limit; /* thread address space */ 318c2ecf20Sopenharmony_ci int preempt_count; /* 0 => preemptable, <0 => BUG */ 328c2ecf20Sopenharmony_ci __u32 cpu; /* should always be 0 on m68k */ 338c2ecf20Sopenharmony_ci unsigned long tp_value; /* thread pointer */ 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define INIT_THREAD_INFO(tsk) \ 388c2ecf20Sopenharmony_ci{ \ 398c2ecf20Sopenharmony_ci .task = &tsk, \ 408c2ecf20Sopenharmony_ci .addr_limit = KERNEL_DS, \ 418c2ecf20Sopenharmony_ci .preempt_count = INIT_PREEMPT_COUNT, \ 428c2ecf20Sopenharmony_ci} 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 458c2ecf20Sopenharmony_ci/* how to get the thread information struct from C */ 468c2ecf20Sopenharmony_cistatic inline struct thread_info *current_thread_info(void) 478c2ecf20Sopenharmony_ci{ 488c2ecf20Sopenharmony_ci struct thread_info *ti; 498c2ecf20Sopenharmony_ci __asm__( 508c2ecf20Sopenharmony_ci "move.l %%sp, %0 \n\t" 518c2ecf20Sopenharmony_ci "and.l %1, %0" 528c2ecf20Sopenharmony_ci : "=&d"(ti) 538c2ecf20Sopenharmony_ci : "di" (~(THREAD_SIZE-1)) 548c2ecf20Sopenharmony_ci ); 558c2ecf20Sopenharmony_ci return ti; 568c2ecf20Sopenharmony_ci} 578c2ecf20Sopenharmony_ci#endif 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/* entry.S relies on these definitions! 608c2ecf20Sopenharmony_ci * bits 0-7 are tested at every exception exit 618c2ecf20Sopenharmony_ci * bits 8-15 are also tested at syscall exit 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_ci#define TIF_NOTIFY_SIGNAL 4 648c2ecf20Sopenharmony_ci#define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ 658c2ecf20Sopenharmony_ci#define TIF_SIGPENDING 6 /* signal pending */ 668c2ecf20Sopenharmony_ci#define TIF_NEED_RESCHED 7 /* rescheduling necessary */ 678c2ecf20Sopenharmony_ci#define TIF_DELAYED_TRACE 14 /* single step a syscall */ 688c2ecf20Sopenharmony_ci#define TIF_SYSCALL_TRACE 15 /* syscall trace active */ 698c2ecf20Sopenharmony_ci#define TIF_MEMDIE 16 /* is terminating due to OOM killer */ 708c2ecf20Sopenharmony_ci#define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal */ 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 738c2ecf20Sopenharmony_ci#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 748c2ecf20Sopenharmony_ci#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 758c2ecf20Sopenharmony_ci#define _TIF_DELAYED_TRACE (1 << TIF_DELAYED_TRACE) 768c2ecf20Sopenharmony_ci#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 778c2ecf20Sopenharmony_ci#define _TIF_MEMDIE (1 << TIF_MEMDIE) 788c2ecf20Sopenharmony_ci#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci#endif /* _ASM_M68K_THREAD_INFO_H */ 81