| 1 | |
| 2 | * NiosII low-level thread information
|
| 3 | *
|
| 4 | * Copyright (C) 2011 Tobias Klauser <[email protected]>
|
| 5 | * Copyright (C) 2004 Microtronix Datacom Ltd.
|
| 6 | *
|
| 7 | * Based on asm/thread_info_no.h from m68k which is:
|
| 8 | *
|
| 9 | * Copyright (C) 2002 David Howells <[email protected]>
|
| 10 | *
|
| 11 | * This file is subject to the terms and conditions of the GNU General Public
|
| 12 | * License. See the file "COPYING" in the main directory of this archive
|
| 13 | * for more details.
|
| 14 |
|
| 15 |
|
| 16 | #ifndef _ASM_NIOS2_THREAD_INFO_H
|
| 17 | #define _ASM_NIOS2_THREAD_INFO_H
|
| 18 |
|
| 19 | #ifdef __KERNEL__
|
| 20 |
|
| 21 | |
| 22 | * Size of the kernel stack for each process.
|
| 23 |
|
| 24 | #define THREAD_SIZE_ORDER 1
|
| 25 | #define THREAD_SIZE 8192
|
| 26 |
|
| 27 | #ifndef __ASSEMBLER__
|
| 28 |
|
| 29 | |
| 30 | * low level task data that entry.S needs immediate access to
|
| 31 | * - this struct should fit entirely inside of one cache line
|
| 32 | * - this struct shares the supervisor stack pages
|
| 33 | * - if the contents of this structure are changed, the assembly constants
|
| 34 | * must also be changed
|
| 35 |
|
| 36 | struct thread_info {
|
| 37 | struct task_struct *task;
|
| 38 | unsigned long flags;
|
| 39 | __u32 cpu;
|
| 40 | int preempt_count;
|
| 41 | struct pt_regs *regs;
|
| 42 | };
|
| 43 |
|
| 44 | |
| 45 | * macros/functions for gaining access to the thread information structure
|
| 46 | *
|
| 47 | * preempt_count needs to be 1 initially, until the scheduler is functional.
|
| 48 |
|
| 49 | #define INIT_THREAD_INFO(tsk) \
|
| 50 | { \
|
| 51 | .task = &tsk, \
|
| 52 | .flags = 0, \
|
| 53 | .cpu = 0, \
|
| 54 | .preempt_count = INIT_PREEMPT_COUNT, \
|
| 55 | }
|
| 56 |
|
| 57 |
|
| 58 | static inline struct thread_info *current_thread_info(void)
|
| 59 | {
|
| 60 | register unsigned long sp asm("sp");
|
| 61 |
|
| 62 | return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
|
| 63 | }
|
| 64 | #endif
|
| 65 |
|
| 66 | |
| 67 | * thread information flags
|
| 68 | * - these are process state flags that various assembly files may need to
|
| 69 | * access
|
| 70 | * - pending work-to-be-done flags are in LSW
|
| 71 | * - other flags in MSW
|
| 72 |
|
| 73 | #define TIF_SYSCALL_TRACE 0
|
| 74 | #define TIF_NOTIFY_RESUME 1
|
| 75 | #define TIF_SIGPENDING 2
|
| 76 | #define TIF_NEED_RESCHED 3
|
| 77 | #define TIF_MEMDIE 4
|
| 78 | #define TIF_SECCOMP 5
|
| 79 | #define TIF_SYSCALL_AUDIT 6
|
| 80 | #define TIF_NOTIFY_SIGNAL 7
|
| 81 | #define TIF_RESTORE_SIGMASK 9
|
| 82 |
|
| 83 | #define TIF_POLLING_NRFLAG 16 |
| 84 | TIF_NEED_RESCHED
|
| 85 |
|
| 86 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
|
| 87 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
|
| 88 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
|
| 89 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
|
| 90 | #define _TIF_SECCOMP (1 << TIF_SECCOMP)
|
| 91 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
|
| 92 | #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
|
| 93 | #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
|
| 94 | #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
|
| 95 |
|
| 96 |
|
| 97 | #define _TIF_WORK_MASK 0x0000FFFE
|
| 98 |
|
| 99 | #endif
|
| 100 |
|
| 101 | #endif
|