20 |
|
|
21 |
struct processor |
struct processor |
22 |
{ |
{ |
23 |
int cpu_id; /* CPU ID for this processor. */ |
/* CPU id for this processor. */ |
24 |
int state; /* State of processor. */ |
int cpu_id; |
25 |
|
|
26 |
|
/* State of processor. Normal state is either running or idle. */ |
27 |
|
int state; |
28 |
|
|
29 |
|
/* Next thread to run on this processor. */ |
30 |
|
struct thread *next_thread; |
31 |
|
|
32 |
|
/* ??? Current thread executing on this processor. */ |
33 |
struct thread *current_thread; |
struct thread *current_thread; |
34 |
|
|
35 |
|
/* Idle thread for this processor. */ |
36 |
struct thread *idle_thread; |
struct thread *idle_thread; |
37 |
|
|
38 |
|
/* ??? needed? */ |
39 |
int quantum; |
int quantum; |
40 |
}; |
}; |
41 |
|
|
42 |
#define PROCESSOR_STATE_UNINIT 0 |
/* Processor states. */ |
43 |
#define PROCESSOR_STATE_RUNNING 1 |
|
44 |
#define PROCESSOR_STATE_HALTED 2 |
#define PROCESSOR_STATE_UNINIT 0 |
45 |
#define PROCESSOR_STATE_IDLE 3 |
#define PROCESSOR_STATE_RUNNING 1 |
46 |
|
#define PROCESSOR_STATE_HALTED 2 |
47 |
|
#define PROCESSOR_STATE_IDLE 3 |
48 |
|
#define PROCESSOR_STATE_DISPATCH 4 |
49 |
|
|
50 |
extern struct processor processor_array [NCPUS]; |
extern struct processor processor_array [NCPUS]; |
51 |
#define PROCESSOR_CURRENT() (& processor_array [CPU_CURRENT ()]) |
#define PROCESSOR_CURRENT() (& processor_array [CPU_CURRENT ()]) |