Decoupling Architectural-specific Code (#35)
[lunaix-os.git] / lunaix-os / arch / i386 / arch.c
1 #include <hal/hwtimer.h>
2
3 #include <lunaix/generic/isrm.h>
4 #include <lunaix/spike.h>
5
6 #include "sys/i386_intr.h"
7 #include "sys/hart.h"
8
9 #include "hal/apic_timer.h"
10
11 void
12 exception_init()
13 {
14     exception_install_handler();
15     isrm_init();
16     intr_routine_init();
17 }
18
19 extern void
20 syscall_hndlr(const struct hart_state* hstate);
21
22 void
23 arch_preinit()
24 {
25     exception_init();
26
27     isrm_bindiv(LUNAIX_SYS_CALL, syscall_hndlr);
28 }
29
30 struct hwtimer*
31 select_platform_timer()
32 {
33     struct hwtimer* timer;
34
35     timer = apic_hwtimer_context();
36     if (timer->supported(timer)) {
37         return timer;
38     }
39
40     // TODO select alternatives...
41
42     panick("no timer to use.");
43 }