tools, slub: Fix off-by-one buffer corruption after readlink() call
[linux-2.6/linux-mips.git] / arch / score / include / asm / thread_info.h
blob2205c62284dba93c87e9726465abc29ccd272e72
1 #ifndef _ASM_SCORE_THREAD_INFO_H
2 #define _ASM_SCORE_THREAD_INFO_H
4 #ifdef __KERNEL__
6 #define KU_MASK 0x08
7 #define KU_USER 0x08
8 #define KU_KERN 0x00
10 #include <asm/page.h>
11 #include <linux/const.h>
13 /* thread information allocation */
14 #define THREAD_SIZE_ORDER (1)
15 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
16 #define THREAD_MASK (THREAD_SIZE - _AC(1,UL))
17 #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
19 #ifndef __ASSEMBLY__
21 #include <asm/processor.h>
24 * low level task data that entry.S needs immediate access to
25 * - this struct should fit entirely inside of one cache line
26 * - this struct shares the supervisor stack pages
27 * - if the contents of this structure are changed, the assembly constants
28 * must also be changed
30 struct thread_info {
31 struct task_struct *task; /* main task structure */
32 struct exec_domain *exec_domain; /* execution domain */
33 unsigned long flags; /* low level flags */
34 unsigned long tp_value; /* thread pointer */
35 __u32 cpu; /* current CPU */
37 /* 0 => preemptable, < 0 => BUG */
38 int preempt_count;
41 * thread address space:
42 * 0-0xBFFFFFFF for user-thead
43 * 0-0xFFFFFFFF for kernel-thread
45 mm_segment_t addr_limit;
46 struct restart_block restart_block;
47 struct pt_regs *regs;
51 * macros/functions for gaining access to the thread information structure
53 * preempt_count needs to be 1 initially, until the scheduler is functional.
55 #define INIT_THREAD_INFO(tsk) \
56 { \
57 .task = &tsk, \
58 .exec_domain = &default_exec_domain, \
59 .cpu = 0, \
60 .preempt_count = 1, \
61 .addr_limit = KERNEL_DS, \
62 .restart_block = { \
63 .fn = do_no_restart_syscall, \
64 }, \
67 #define init_thread_info (init_thread_union.thread_info)
68 #define init_stack (init_thread_union.stack)
70 /* How to get the thread information struct from C. */
71 register struct thread_info *__current_thread_info __asm__("r28");
72 #define current_thread_info() __current_thread_info
74 #define alloc_thread_info_node(tsk, node) kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
75 #define free_thread_info(info) kfree(info)
77 #endif /* !__ASSEMBLY__ */
79 #define PREEMPT_ACTIVE 0x10000000
82 * thread information flags
83 * - these are process state flags that various assembly files may need to
84 * access
85 * - pending work-to-be-done flags are in LSW
86 * - other flags in MSW
88 #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
89 #define TIF_SIGPENDING 1 /* signal pending */
90 #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
91 #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
92 #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
93 #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling
94 TIF_NEED_RESCHED */
95 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
97 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
98 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
99 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
100 #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
101 #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
102 #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
104 #define _TIF_WORK_MASK (0x0000ffff)
106 #endif /* __KERNEL__ */
108 #endif /* _ASM_SCORE_THREAD_INFO_H */