Subversion Repositories HelenOS

Rev

Rev 2090 | Rev 2093 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2090 Rev 2092
Line 33... Line 33...
33
 */
33
 */
34
 
34
 
35
#ifndef KERN_TASK_H_
35
#ifndef KERN_TASK_H_
36
#define KERN_TASK_H_
36
#define KERN_TASK_H_
37
 
37
 
-
 
38
#include <cpu.h>
38
#include <synch/spinlock.h>
39
#include <synch/spinlock.h>
39
#include <synch/mutex.h>
40
#include <synch/mutex.h>
40
#include <synch/rwlock.h>
41
#include <synch/rwlock.h>
41
#include <synch/futex.h>
42
#include <synch/futex.h>
42
#include <adt/btree.h>
43
#include <adt/btree.h>
Line 131... Line 132...
131
    btree_t futexes;    /**< B+tree of futexes referenced by this task. */
132
    btree_t futexes;    /**< B+tree of futexes referenced by this task. */
132
   
133
   
133
    uint64_t cycles;    /**< Accumulated accounting. */
134
    uint64_t cycles;    /**< Accumulated accounting. */
134
} task_t;
135
} task_t;
135
 
136
 
136
/** CPU structure.
-
 
137
 *
-
 
138
 * There is one structure like this for every processor.
-
 
139
 */
-
 
140
typedef struct {
-
 
141
    SPINLOCK_DECLARE(lock);
-
 
142
 
-
 
143
    tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN];
-
 
144
    count_t tlb_messages_count;
-
 
145
   
-
 
146
    context_t saved_context;
-
 
147
 
-
 
148
    atomic_t nrdy;
-
 
149
    runq_t rq[RQ_COUNT];
-
 
150
    volatile count_t needs_relink;
-
 
151
 
-
 
152
    SPINLOCK_DECLARE(timeoutlock);
-
 
153
    link_t timeout_active_head;
-
 
154
 
-
 
155
    count_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here
-
 
156
                         so that clock() can react. This variable is
-
 
157
                         CPU-local and can be only accessed when interrupts
-
 
158
                         are disabled. */
-
 
159
 
-
 
160
    /**
-
 
161
     * Processor ID assigned by kernel.
-
 
162
     */
-
 
163
    unsigned int id;
-
 
164
   
-
 
165
    int active;
-
 
166
    int tlb_active;
-
 
167
 
-
 
168
    uint16_t frequency_mhz;
-
 
169
    uint32_t delay_loop_const;
-
 
170
 
-
 
171
    cpu_arch_t arch;
-
 
172
 
-
 
173
    struct thread *fpu_owner;
-
 
174
   
-
 
175
    /**
-
 
176
     * Stack used by scheduler when there is no running thread.
-
 
177
     */
-
 
178
    uint8_t *stack;
-
 
179
} cpu_t;
-
 
180
 
-
 
181
typedef void (* timeout_handler_t)(void *arg);
137
typedef void (* timeout_handler_t)(void *arg);
182
 
138
 
183
typedef struct {
139
typedef struct {
184
    SPINLOCK_DECLARE(lock);
140
    SPINLOCK_DECLARE(lock);
185
 
141