Path: blob/master/arch/openrisc/include/asm/thread_info.h
26481 views
/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* OpenRISC Linux3*4* Linux architectural port borrowing liberally from similar works of5* others. All original copyrights apply as per the original source6* declaration.7*8* OpenRISC implementation:9* Copyright (C) 2003 Matjaz Breskvar <[email protected]>10* Copyright (C) 2010-2011 Jonas Bonn <[email protected]>11* et al.12*/1314#ifndef _ASM_THREAD_INFO_H15#define _ASM_THREAD_INFO_H1617#ifdef __KERNEL__1819#ifndef __ASSEMBLER__20#include <asm/types.h>21#include <asm/processor.h>22#endif232425/* THREAD_SIZE is the size of the task_struct/kernel_stack combo.26* normally, the stack is found by doing something like p + THREAD_SIZE27* in or1k, a page is 8192 bytes, which seems like a sane size28*/2930#define THREAD_SIZE_ORDER 031#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)3233/*34* low level task data that entry.S needs immediate access to35* - this struct should fit entirely inside of one cache line36* - this struct shares the supervisor stack pages37* - if the contents of this structure are changed, the assembly constants38* must also be changed39*/40#ifndef __ASSEMBLER__4142struct thread_info {43struct task_struct *task; /* main task structure */44unsigned long flags; /* low level flags */45__u32 cpu; /* current CPU */46__s32 preempt_count; /* 0 => preemptable, <0 => BUG */4748__u8 supervisor_stack[0];4950/* saved context data */51unsigned long ksp;52};53#endif5455/*56* macros/functions for gaining access to the thread information structure57*58* preempt_count needs to be 1 initially, until the scheduler is functional.59*/60#ifndef __ASSEMBLER__61#define INIT_THREAD_INFO(tsk) \62{ \63.task = &tsk, \64.flags = 0, \65.cpu = 0, \66.preempt_count = INIT_PREEMPT_COUNT, \67.ksp = 0, \68}6970/* how to get the thread information struct from C */71register struct thread_info *current_thread_info_reg asm("r10");72#define current_thread_info() (current_thread_info_reg)7374#define get_thread_info(ti) get_task_struct((ti)->task)75#define put_thread_info(ti) put_task_struct((ti)->task)7677#endif /* !__ASSEMBLER__ */7879/*80* thread information flags81* these are process state flags that various assembly files may need to82* access83* - pending work-to-be-done flags are in LSW84* - other flags in MSW85*/86#define TIF_SYSCALL_TRACE 0 /* syscall trace active */87#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */88#define TIF_SIGPENDING 2 /* signal pending */89#define TIF_NEED_RESCHED 3 /* rescheduling necessary */90#define TIF_SINGLESTEP 4 /* restore singlestep on return to user91* mode92*/93#define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */94#define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */95#define TIF_RESTORE_SIGMASK 996#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling * TIF_NEED_RESCHED97*/98#define TIF_MEMDIE 1799100#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)101#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)102#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)103#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)104#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)105#define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)106#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)107108109/* Work to do when returning from interrupt/exception */110/* For OpenRISC, this is anything in the LSW other than syscall trace */111#define _TIF_WORK_MASK (0xff & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP))112113#endif /* __KERNEL__ */114115#endif /* _ASM_THREAD_INFO_H */116117118