-
Notifications
You must be signed in to change notification settings - Fork 82
/
irq_entry.S
58 lines (51 loc) · 1.34 KB
/
irq_entry.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "config.h"
/* ********************************************************************** */
.section isr_section,"awx",@progbits
.global __apic_irq_tsc, __apic_irq_rax, __apic_deadline_tsc
__apic_irq_tsc:
.quad 0x0
__apic_deadline_tsc:
.quad 0x0
__apic_irq_rax:
.quad 0x0
__apic_irq_rcx:
.quad 0x0
__apic_irq_rdx:
.quad 0x0
/* ********************************************************************** */
.section isr_section,"awx",@progbits
.global __apic_irq_handler_timer
__apic_irq_handler_timer:
mov %rax, __apic_irq_rax(%rip)
mov %rdx, __apic_irq_rdx(%rip)
rdtsc
mov %eax, __apic_irq_tsc(%rip)
mov %edx, __apic_irq_tsc+4(%rip)
/* IRQ bookkeeping */
incl __ss_irq_fired(%rip)
/* apic_write(APIC_EOI, 0x0); */
lea apic_base(%rip), %rax
mov (%rax),%rax
test %rax, %rax
jz 1f
add $0xb0, %rax
movl $0x0, (%rax)
1:
mov __apic_irq_rax(%rip), %rax
mov __apic_irq_rdx(%rip), %rdx
iretq
.section isr_section,"awx",@progbits
.global __apic_priv_irq_gate
__apic_priv_irq_gate:
push %rax
push %rcx
push %rdx
/* wrmsr(IA32_TSC_DEADLINE_MSR, __apic_deadline_tsc) */
mov __apic_deadline_tsc(%rip), %eax
mov __apic_deadline_tsc+4(%rip), %edx
mov $IA32_TSC_DEADLINE_MSR, %ecx
wrmsr
pop %rdx
pop %rcx
pop %rax
iretq