46 LAPIC_LVT_TIMER = 0x32,
47 LAPIC_LVT_THERM = 0x33,
48 LAPIC_LVT_PERFM = 0x34,
49 LAPIC_LVT_LINT0 = 0x35,
50 LAPIC_LVT_LINT1 = 0x36,
51 LAPIC_LVT_ERROR = 0x37,
55 LAPIC_IPI_SELF = 0x3f,
59 static inline uint32 read (Register reg)
61 return *
reinterpret_cast<uint32
volatile *
>(LAPIC_ADDR + (reg << 4));
65 static inline void write (Register reg, uint32 val)
67 *
reinterpret_cast<uint32
volatile *
>(LAPIC_ADDR + (reg << 4)) = val;
71 static inline void set_lvt (Register reg,
unsigned vector, Delivery_mode dlv, Mask msk = UNMASKED)
73 write (reg, msk | dlv | vector);
77 static inline void timer_handler();
80 static inline void error_handler();
83 static inline void perfm_handler();
86 static inline void therm_handler();
89 static unsigned freq_tsc;
90 static unsigned freq_bus;
93 static inline unsigned id()
95 return read (LAPIC_IDR) >> 24 & 0xff;
99 static inline unsigned version()
101 return read (LAPIC_LVR) & 0xff;
105 static inline unsigned lvt_max()
107 return read (LAPIC_LVR) >> 16 & 0xff;
111 static inline void eoi()
113 write (LAPIC_EOI, 0);
117 static inline void set_timer (
unsigned val)
119 write (LAPIC_TMR_ICR, val);
123 static inline unsigned get_timer()
125 return read (LAPIC_TMR_CCR);
129 static void calibrate();
132 static void lvt_vector (
unsigned)
asm (
"lvt_vector");