Subversion Repositories HelenOS

Rev

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

Rev 2079 Rev 2089
Line 33... Line 33...
33
 */
33
 */
34
 
34
 
35
#ifndef KERN_CPU_H_
35
#ifndef KERN_CPU_H_
36
#define KERN_CPU_H_
36
#define KERN_CPU_H_
37
 
37
 
38
#include <arch/cpu.h>
-
 
39
#include <proc/scheduler.h>
-
 
40
#include <synch/spinlock.h>
-
 
41
#include <synch/waitq.h>
-
 
42
#include <arch/types.h>
38
#include <proc/thread.h>
43
#include <typedefs.h>
-
 
44
#include <arch/context.h>
-
 
45
#include <config.h>
-
 
46
#include <adt/list.h>
-
 
47
#include <mm/tlb.h>
-
 
48
 
39
 
49
#define CPU_STACK_SIZE  STACK_SIZE
40
#define CPU_STACK_SIZE  STACK_SIZE
50
 
41
 
51
/** CPU structure.
-
 
52
 *
-
 
53
 * There is one structure like this for every processor.
-
 
54
 */
-
 
55
typedef struct {
-
 
56
    SPINLOCK_DECLARE(lock);
-
 
57
 
-
 
58
    tlb_shootdown_msg_t tlb_messages[TLB_MESSAGE_QUEUE_LEN];
-
 
59
    count_t tlb_messages_count;
-
 
60
   
-
 
61
    context_t saved_context;
-
 
62
 
-
 
63
    atomic_t nrdy;
-
 
64
    runq_t rq[RQ_COUNT];
-
 
65
    volatile count_t needs_relink;
-
 
66
 
-
 
67
    SPINLOCK_DECLARE(timeoutlock);
-
 
68
    link_t timeout_active_head;
-
 
69
 
-
 
70
    count_t missed_clock_ticks; /**< When system clock loses a tick, it is recorded here
-
 
71
                         so that clock() can react. This variable is
-
 
72
                         CPU-local and can be only accessed when interrupts
-
 
73
                         are disabled. */
-
 
74
 
-
 
75
    /**
-
 
76
     * Processor ID assigned by kernel.
-
 
77
     */
-
 
78
    int id;
-
 
79
   
-
 
80
    int active;
-
 
81
    int tlb_active;
-
 
82
 
-
 
83
    uint16_t frequency_mhz;
-
 
84
    uint32_t delay_loop_const;
-
 
85
 
-
 
86
    cpu_arch_t arch;
-
 
87
 
-
 
88
    thread_t *fpu_owner;
-
 
89
   
-
 
90
    /**
-
 
91
     * Stack used by scheduler when there is no running thread.
-
 
92
     */
-
 
93
    uint8_t *stack;
-
 
94
} cpu_t;
-
 
95
 
-
 
96
extern cpu_t *cpus;
42
extern cpu_t *cpus;
97
 
43
 
98
extern void cpu_init(void);
44
extern void cpu_init(void);
99
extern void cpu_list(void);
45
extern void cpu_list(void);
100
 
46