1235267Sgabor/* SPDX-License-Identifier: GPL-2.0 */ 2251245Sgabor/* 3235267Sgabor * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 4235267Sgabor */ 5235267Sgabor 6235267Sgabor#ifndef __UM_THREAD_INFO_H 7235267Sgabor#define __UM_THREAD_INFO_H 8235267Sgabor 9235267Sgabor#define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER 10235267Sgabor#define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE) 11235267Sgabor 12235267Sgabor#ifndef __ASSEMBLY__ 13235267Sgabor 14235267Sgabor#include <asm/types.h> 15235267Sgabor#include <asm/page.h> 16235267Sgabor#include <asm/segment.h> 17235267Sgabor#include <sysdep/ptrace_user.h> 18235267Sgabor 19235267Sgaborstruct thread_info { 20235267Sgabor struct task_struct *task; /* main task structure */ 21235267Sgabor unsigned long flags; /* low level flags */ 22235267Sgabor __u32 cpu; /* current CPU */ 23235267Sgabor int preempt_count; /* 0 => preemptable, 24235267Sgabor <0 => BUG */ 25235267Sgabor struct thread_info *real_thread; /* Points to non-IRQ stack */ 26235267Sgabor unsigned long aux_fp_regs[FP_SIZE]; /* auxiliary fp_regs to save/restore 27235267Sgabor them out-of-band */ 28235267Sgabor}; 29235267Sgabor 30235267Sgabor#define INIT_THREAD_INFO(tsk) \ 31235267Sgabor{ \ 32235267Sgabor .task = &tsk, \ 33235267Sgabor .flags = 0, \ 34235267Sgabor .cpu = 0, \ 35235267Sgabor .preempt_count = INIT_PREEMPT_COUNT, \ 36235267Sgabor .real_thread = NULL, \ 37235267Sgabor} 38235267Sgabor 39235267Sgabor/* how to get the thread information struct from C */ 40235267Sgaborstatic inline struct thread_info *current_thread_info(void) 41235267Sgabor{ 42235267Sgabor struct thread_info *ti; 43235267Sgabor unsigned long mask = THREAD_SIZE - 1; 44235267Sgabor void *p; 45235267Sgabor 46235267Sgabor asm volatile ("" : "=r" (p) : "0" (&ti)); 47235267Sgabor ti = (struct thread_info *) (((unsigned long)p) & ~mask); 48235267Sgabor return ti; 49235267Sgabor} 50235267Sgabor 51235267Sgabor#endif 52235267Sgabor 53235267Sgabor#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 54235267Sgabor#define TIF_SIGPENDING 1 /* signal pending */ 55235267Sgabor#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 56235267Sgabor#define TIF_NOTIFY_SIGNAL 3 /* signal notifications exist */ 57235267Sgabor#define TIF_RESTART_BLOCK 4 58235267Sgabor#define TIF_MEMDIE 5 /* is terminating due to OOM killer */ 59235267Sgabor#define TIF_SYSCALL_AUDIT 6 60235267Sgabor#define TIF_RESTORE_SIGMASK 7 61235267Sgabor#define TIF_NOTIFY_RESUME 8 62235267Sgabor#define TIF_SECCOMP 9 /* secure computing */ 63235267Sgabor#define TIF_SINGLESTEP 10 /* single stepping userspace */ 64235267Sgabor 65235267Sgabor#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 66235267Sgabor#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 67235267Sgabor#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 68235267Sgabor#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 69235267Sgabor#define _TIF_MEMDIE (1 << TIF_MEMDIE) 70235267Sgabor#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 71235267Sgabor#define _TIF_SECCOMP (1 << TIF_SECCOMP) 72235267Sgabor#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 73235267Sgabor 74235267Sgabor#endif 75235267Sgabor