OpenCores
URL https://opencores.org/ocsvn/or1k_soc_on_altera_embedded_dev_kit/or1k_soc_on_altera_embedded_dev_kit/trunk

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [linux-2.6/] [linux-2.6.24/] [include/] [asm-or32/] [thread_info.h] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 xianfeng
/* thread_info.h: OpenRISC low-level thread information
2
 *
3
 * Copyright (C) 2002  David Howells (dhowells@redhat.com)
4
 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
5
 *
6
 *
7
 */
8
 
9
#ifndef _ASM_THREAD_INFO_H
10
#define _ASM_THREAD_INFO_H
11
 
12
#ifdef __KERNEL__
13
 
14
#ifndef __ASSEMBLY__
15
#include <asm/types.h>
16
#include <asm/processor.h>
17
#endif
18
 
19
 
20
/*
21
 * low level task data that entry.S needs immediate access to
22
 * - this struct should fit entirely inside of one cache line
23
 * - this struct shares the supervisor stack pages
24
 * - if the contents of this structure are changed, the assembly constants must also be changed
25
 */
26
#ifndef __ASSEMBLY__
27
struct thread_info {
28
        struct task_struct      *task;          /* main task structure */
29
        struct exec_domain      *exec_domain;   /* execution domain */
30
        unsigned long           flags;          /* low level flags */
31
        __u32                   cpu;            /* current CPU */
32
        __s32                   preempt_count; /* 0 => preemptable, <0 => BUG */
33
 
34
        mm_segment_t            addr_limit;     /* thread address space:
35
                                                   0-0x7FFFFFFF for user-thead
36
                                                   0-0xFFFFFFFF for kernel-thread
37
                                                */
38
        struct restart_block    restart_block;
39
        __u8                    supervisor_stack[0];
40
 
41
        /* saved context data */
42
        unsigned long           ksp;
43
};
44
 
45
#else /* !__ASSEMBLY */
46
 
47
/* offsets into the thread_info struct for assembly code access */
48
#define TI_TASK         0x00000000
49
#define TI_EXEC_DOMAIN  0x00000004
50
#define TI_FLAGS        0x00000008
51
#define TI_STATUS       0x0000000C
52
#define TI_CPU          0x00000010
53
#define TI_PRE_COUNT    0x00000014
54
#define TI_ADDR_LIMIT   0x00000018
55
#define TI_RESTART_BLOCK 0x000001C
56
 
57
#endif
58
 
59
#define PREEMPT_ACTIVE          0x4000000
60
 
61
/*
62
 * macros/functions for gaining access to the thread information structure
63
 *
64
 * preempt_count needs to be 1 initially, until the scheduler is functional.
65
 */
66
#ifndef __ASSEMBLY__
67
#define INIT_THREAD_INFO(tsk)                           \
68
{                                                       \
69
        .task           = &tsk,                         \
70
        .exec_domain    = &default_exec_domain,         \
71
        .flags          = 0,                             \
72
        .cpu            = 0,                             \
73
        .preempt_count  = 1,                            \
74
        .addr_limit     = KERNEL_DS,                    \
75
        .restart_block  = {                             \
76
                        .fn = do_no_restart_syscall,    \
77
        },                                              \
78
        .ksp            = 0,                            \
79
}
80
 
81
#define init_thread_info        (init_thread_union.thread_info)
82
 
83
#if 0
84
/* how to get the thread information struct from C */
85
static inline struct thread_info *current_thread_info(void)
86
{
87
        struct thread_info *ti;
88
        __asm__("/* current_thread_info */"
89
                "l.srli %0,r1,%1;"
90
                "l.slli %0,%0,%1" : "=r" (ti) : "K" (PAGE_SHIFT));
91
        return ti;
92
}
93
#endif
94
#if 0
95
/* how to get the thread information struct from C */
96
static inline struct thread_info *current_thread_info(void)
97
{
98
        struct thread_info *ti;
99
        __asm__("l.ori %0,r10,%1" : "=r" (ti) : "K" (0));
100
        return ti;
101
}
102
#endif
103
 
104
/* how to get the thread information struct from C */
105
register struct thread_info *current_thread_info_reg asm("r10");
106
#define current_thread_info()   (current_thread_info_reg)
107
 
108
/* thread information allocation */
109
#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
110
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
111
#define get_thread_info(ti) get_task_struct((ti)->task)
112
#define put_thread_info(ti) put_task_struct((ti)->task)
113
 
114
#endif /* !__ASSEMBLY__ */
115
 
116
/*
117
 * thread information flags
118
 * - these are process state flags that various assembly files may need to access
119
 * - pending work-to-be-done flags are in LSW
120
 * - other flags in MSW
121
 */
122
#define TIF_SYSCALL_TRACE       0        /* syscall trace active */
123
#define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
124
#define TIF_SIGPENDING          2       /* signal pending */
125
#define TIF_NEED_RESCHED        3       /* rescheduling necessary */
126
#define TIF_SINGLESTEP          4       /* restore singlestep on return to user mode */
127
#define TIF_POLLING_NRFLAG      16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
128
#define TIF_MEMDIE              17
129
 
130
#define _TIF_SYSCALL_TRACE      (1<<TIF_SYSCALL_TRACE)
131
#define _TIF_NOTIFY_RESUME      (1<<TIF_NOTIFY_RESUME)
132
#define _TIF_SIGPENDING         (1<<TIF_SIGPENDING)
133
#define _TIF_NEED_RESCHED       (1<<TIF_NEED_RESCHED)
134
#define _TIF_SINGLESTEP         (1<<TIF_SINGLESTEP)
135
#define _TIF_POLLING_NRFLAG     (1<<TIF_POLLING_NRFLAG)
136
 
137
/* work to do on interrupt/exception return */
138
#define _TIF_WORK_MASK \
139
  (0x0000FFFE & ~(_TIF_SYSCALL_TRACE|_TIF_SINGLESTEP))
140
/* work to do on any return to u-space */
141
#define _TIF_ALLWORK_MASK       0x0000FFFF
142
 
143
#endif /* __KERNEL__ */
144
 
145
#endif /* _ASM_THREAD_INFO_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.