/*1* NiosII low-level thread information2*3* Copyright (C) 2011 Tobias Klauser <[email protected]>4* Copyright (C) 2004 Microtronix Datacom Ltd.5*6* Based on asm/thread_info_no.h from m68k which is:7*8* Copyright (C) 2002 David Howells <[email protected]>9*10* This file is subject to the terms and conditions of the GNU General Public11* License. See the file "COPYING" in the main directory of this archive12* for more details.13*/1415#ifndef _ASM_NIOS2_THREAD_INFO_H16#define _ASM_NIOS2_THREAD_INFO_H1718#ifdef __KERNEL__1920/*21* Size of the kernel stack for each process.22*/23#define THREAD_SIZE_ORDER 124#define THREAD_SIZE 8192 /* 2 * PAGE_SIZE */2526#ifndef __ASSEMBLY__2728/*29* low level task data that entry.S needs immediate access to30* - this struct should fit entirely inside of one cache line31* - this struct shares the supervisor stack pages32* - if the contents of this structure are changed, the assembly constants33* must also be changed34*/35struct thread_info {36struct task_struct *task; /* main task structure */37unsigned long flags; /* low level flags */38__u32 cpu; /* current CPU */39int preempt_count; /* 0 => preemptable,<0 => BUG */40struct pt_regs *regs;41};4243/*44* macros/functions for gaining access to the thread information structure45*46* preempt_count needs to be 1 initially, until the scheduler is functional.47*/48#define INIT_THREAD_INFO(tsk) \49{ \50.task = &tsk, \51.flags = 0, \52.cpu = 0, \53.preempt_count = INIT_PREEMPT_COUNT, \54}5556/* how to get the thread information struct from C */57static inline struct thread_info *current_thread_info(void)58{59register unsigned long sp asm("sp");6061return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));62}63#endif /* !__ASSEMBLY__ */6465/*66* thread information flags67* - these are process state flags that various assembly files may need to68* access69* - pending work-to-be-done flags are in LSW70* - other flags in MSW71*/72#define TIF_SYSCALL_TRACE 0 /* syscall trace active */73#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */74#define TIF_SIGPENDING 2 /* signal pending */75#define TIF_NEED_RESCHED 3 /* rescheduling necessary */76#define TIF_MEMDIE 4 /* is terminating due to OOM killer */77#define TIF_SECCOMP 5 /* secure computing */78#define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */79#define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */80#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */8182#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling83TIF_NEED_RESCHED */8485#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)86#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)87#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)88#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)89#define _TIF_SECCOMP (1 << TIF_SECCOMP)90#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)91#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)92#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)93#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)9495/* work to do on interrupt/exception return */96#define _TIF_WORK_MASK 0x0000FFFE9798#endif /* __KERNEL__ */99100#endif /* _ASM_NIOS2_THREAD_INFO_H */101102103