]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ia32/timer_tick-apic.cpp
603151cdcd8b5566b8f82a1765bc2614264feef8
[l4.git] / kernel / fiasco / src / kern / ia32 / timer_tick-apic.cpp
1 IMPLEMENTATION [ia32 || amd64]:
2
3 #include "apic.h"
4 #include "idt.h"
5
6 IMPLEMENT
7 void
8 Timer_tick::setup(unsigned)
9 {}
10
11 IMPLEMENT
12 void
13 Timer_tick::enable(unsigned)
14 {
15   Apic::timer_enable_irq();
16   Apic::irq_ack();
17 }
18
19 IMPLEMENT
20 void
21 Timer_tick::disable(unsigned)
22 {
23   Apic::timer_disable_irq();
24 }
25
26 PUBLIC static inline NEEDS["apic.h"]
27 void
28 Timer_tick::ack()
29 {
30   Apic::irq_ack();
31 }
32
33 PUBLIC static
34 void
35 Timer_tick::set_vectors_stop()
36 {
37   extern char entry_int_timer_stop[];
38   // acknowledge timer interrupt once to keep timer interrupt alive because
39   // we could be called from thread_timer_interrupt_slow() before ack
40   Apic::irq_ack();
41
42   // set timer interrupt to dummy doing nothing
43   Idt::set_entry(Config::scheduler_irq_vector, (Address)entry_int_timer_stop, false);
44 #if 0
45   // From ``8259A PROGRAMMABLE INTERRUPT CONTROLLER (8259A 8259A-2)'': If no
46   // interrupt request is present at step 4 of either sequence (i. e. the
47   // request was too short in duration) the 8259A will issue an interrupt
48   // level 7. Both the vectoring bytes and the CAS lines will look like an
49   // interrupt level 7 was requested.
50   set_entry(0x27, (Address)entry_int_pic_ignore, false);
51   set_entry(0x2f, (Address)entry_int_pic_ignore, false);
52 #endif
53 }
54
55 // We are entering with disabled interrupts!
56 extern "C" FIASCO_FASTCALL
57 void
58 thread_timer_interrupt(Address ip)
59 {
60   (void)ip;
61   Timer_tick::handler_all(0, 0); //Timer_tick::_glbl_timer);
62 }
63
64 /** Extra version of timer interrupt handler which is used when the jdb is
65     active to prevent busy waiting. */
66 extern "C"
67 void
68 thread_timer_interrupt_stop(void)
69 {
70   Apic::irq_ack();
71 }