Unifying External Interrupt System (#51)
[lunaix-os.git] / lunaix-os / arch / x86 / arch.c
1 #include <hal/hwtimer.h>
2
3 #include <lunaix/spike.h>
4 #include <lunaix/process.h>
5
6 #include "asm/x86.h"
7 #include "asm/hart.h"
8
9 #include "hal/apic_timer.h"
10
11 void
12 exception_init()
13 {
14     exception_install_handler();
15 }
16
17 void
18 arch_preinit()
19 {
20     exception_init();
21 }
22
23 void
24 update_tss()
25 {
26     extern struct x86_tss _tss;
27 #ifdef CONFIG_ARCH_X86_64
28     _tss.rsps[0] = (ptr_t)current_thread->hstate;
29 #else
30     _tss.esp0 = (u32_t)current_thread->hstate;
31 #endif
32 }