Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 1 | #ifndef _ASM_SCORE_THREAD_INFO_H |
| 2 | #define _ASM_SCORE_THREAD_INFO_H |
| 3 | |
| 4 | #ifdef __KERNEL__ |
| 5 | |
| 6 | #define KU_MASK 0x08 |
| 7 | #define KU_USER 0x08 |
| 8 | #define KU_KERN 0x00 |
| 9 | |
Tim Abbott | 0dab100 | 2009-09-20 13:32:58 -0400 | [diff] [blame] | 10 | #include <asm/page.h> |
| 11 | #include <linux/const.h> |
| 12 | |
| 13 | /* thread information allocation */ |
Thomas Gleixner | c4e2689 | 2012-05-05 15:05:46 +0000 | [diff] [blame] | 14 | #define THREAD_SIZE_ORDER (1) |
| 15 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
| 16 | #define THREAD_MASK (THREAD_SIZE - _AC(1,UL)) |
Tim Abbott | 0dab100 | 2009-09-20 13:32:58 -0400 | [diff] [blame] | 17 | |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 18 | #ifndef __ASSEMBLY__ |
| 19 | |
| 20 | #include <asm/processor.h> |
| 21 | |
| 22 | /* |
| 23 | * low level task data that entry.S needs immediate access to |
| 24 | * - this struct should fit entirely inside of one cache line |
| 25 | * - this struct shares the supervisor stack pages |
| 26 | * - if the contents of this structure are changed, the assembly constants |
| 27 | * must also be changed |
| 28 | */ |
| 29 | struct thread_info { |
| 30 | struct task_struct *task; /* main task structure */ |
| 31 | struct exec_domain *exec_domain; /* execution domain */ |
| 32 | unsigned long flags; /* low level flags */ |
| 33 | unsigned long tp_value; /* thread pointer */ |
| 34 | __u32 cpu; /* current CPU */ |
| 35 | |
| 36 | /* 0 => preemptable, < 0 => BUG */ |
| 37 | int preempt_count; |
| 38 | |
| 39 | /* |
| 40 | * thread address space: |
| 41 | * 0-0xBFFFFFFF for user-thead |
| 42 | * 0-0xFFFFFFFF for kernel-thread |
| 43 | */ |
| 44 | mm_segment_t addr_limit; |
| 45 | struct restart_block restart_block; |
| 46 | struct pt_regs *regs; |
| 47 | }; |
| 48 | |
| 49 | /* |
| 50 | * macros/functions for gaining access to the thread information structure |
| 51 | * |
| 52 | * preempt_count needs to be 1 initially, until the scheduler is functional. |
| 53 | */ |
| 54 | #define INIT_THREAD_INFO(tsk) \ |
| 55 | { \ |
| 56 | .task = &tsk, \ |
| 57 | .exec_domain = &default_exec_domain, \ |
| 58 | .cpu = 0, \ |
| 59 | .preempt_count = 1, \ |
| 60 | .addr_limit = KERNEL_DS, \ |
| 61 | .restart_block = { \ |
| 62 | .fn = do_no_restart_syscall, \ |
| 63 | }, \ |
| 64 | } |
| 65 | |
| 66 | #define init_thread_info (init_thread_union.thread_info) |
| 67 | #define init_stack (init_thread_union.stack) |
| 68 | |
| 69 | /* How to get the thread information struct from C. */ |
| 70 | register struct thread_info *__current_thread_info __asm__("r28"); |
| 71 | #define current_thread_info() __current_thread_info |
| 72 | |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 73 | #endif /* !__ASSEMBLY__ */ |
| 74 | |
| 75 | #define PREEMPT_ACTIVE 0x10000000 |
| 76 | |
| 77 | /* |
| 78 | * thread information flags |
| 79 | * - these are process state flags that various assembly files may need to |
| 80 | * access |
| 81 | * - pending work-to-be-done flags are in LSW |
| 82 | * - other flags in MSW |
| 83 | */ |
| 84 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ |
| 85 | #define TIF_SIGPENDING 1 /* signal pending */ |
| 86 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ |
Chen Liqin | 9973aff | 2009-09-17 12:05:56 +0800 | [diff] [blame] | 87 | #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 88 | #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */ |
| 89 | #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling |
| 90 | TIF_NEED_RESCHED */ |
Andreas Dilger | 0ddc932 | 2010-05-14 11:13:27 +0200 | [diff] [blame] | 91 | #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 92 | |
| 93 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) |
| 94 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
| 95 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
Chen Liqin | 9973aff | 2009-09-17 12:05:56 +0800 | [diff] [blame] | 96 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 97 | #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK) |
| 98 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) |
| 99 | |
| 100 | #define _TIF_WORK_MASK (0x0000ffff) |
| 101 | |
| 102 | #endif /* __KERNEL__ */ |
| 103 | |
| 104 | #endif /* _ASM_SCORE_THREAD_INFO_H */ |