1818global unused_interrupt_handler:function
1919global modern_interrupt_handler:function
2020global cpu_sampling_irq_entry:function
21+ global parasite_interrupt_handler:function
22+ global __stack_storage_area
2123
2224extern current_eoi_mechanism
2325extern current_intr_handler
2426extern cpu_sampling_irq_handler
27+ extern profiler_stack_sampler
2528
2629SECTION .bss
2730ALIGN 16
28- xsave_storage_area : resb 512
31+ __xsave_storage_area : resb 512
2932ALIGN 16
30- stack_storage_area : resb 512
33+ __stack_storage_area : resb 512
3134
3235%macro PUSHAQ 0
3336 push rax
@@ -46,11 +49,11 @@ stack_storage_area: resb 512
4649 push r15
4750
4851 ; Preserve extended state
49- fxsave [ xsave_storage_area ]
52+ ; fxsave [__xsave_storage_area ]
5053%endmacro
5154%macro POPAQ 0
5255 ; Restore extended state
53- fxrstor [ xsave_storage_area ]
56+ ; fxrstor [__xsave_storage_area ]
5457
5558 pop r15
5659 pop r14
@@ -70,7 +73,7 @@ stack_storage_area: resb 512
7073
7174%macro SPSAVE 0
7275 mov rax , rsp
73- mov rsp , stack_storage_area + 512 - 16
76+ mov rsp , __stack_storage_area + 512 - 16
7477 push rax ;; save old RSP
7578 push rbp
7679%endmacro
@@ -111,3 +114,15 @@ cpu_sampling_irq_entry:
111114 POPAQ
112115 sti
113116 iretq
117+
118+ parasite_interrupt_handler:
119+ cli
120+ PUSHAQ
121+ mov rdi , QWORD [ rsp + 8 * 14 ]
122+ SPSAVE
123+ call profiler_stack_sampler
124+ call QWORD [ current_intr_handler ]
125+ SPRSTOR
126+ POPAQ
127+ sti
128+ iretq
0 commit comments