xref: /reactos/hal/halx86/apic/apictrap.S (revision c2c66aff)
1/*
2 * FILE:            hal/halx86/apic/apictrap.S
3 * COPYRIGHT:       See COPYING in the top level directory
4 * PURPOSE:         System Traps, Entrypoints and Exitpoints
5 * PROGRAMMER:      Timo Kreuzer (timo.kreuzer@reactos.org)
6 * NOTE:            See asmmacro.S for the shared entry/exit code.
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <asm.inc>
12
13#ifdef _M_AMD64
14#include <ksamd64.inc>
15#include <trapamd64.inc>
16.code
17
18TRAP_ENTRY HalpClockInterrupt, (TF_VOLATILES OR TF_SEND_EOI)
19TRAP_ENTRY HalpProfileInterrupt, (TF_VOLATILES OR TF_SEND_EOI)
20
21PUBLIC ApicSpuriousService
22ApicSpuriousService:
23    iret
24
25PUBLIC HackEoi
26HackEoi:
27    xor rax, rax
28    mov ax, ss
29    push rax
30    push rsp
31    pushfq
32    mov ax, cs
33    push rax
34    lea rax, HackEoiReturn[rip]
35    push rax
36    mov dword ptr [HEX(0FFFFFFFFFFFE00B0)], 0
37    iretq
38HackEoiReturn:
39    add rsp, 8 // esp was changed by the iret to the pushed value
40    ret
41
42#else
43#include <ks386.inc>
44#include <internal/i386/asmmacro.S>
45.code
46
47TRAP_ENTRY HalpClockInterrupt, KI_PUSH_FAKE_ERROR_CODE
48TRAP_ENTRY HalpProfileInterrupt, KI_PUSH_FAKE_ERROR_CODE
49TRAP_ENTRY HalpTrap0D, 0
50TRAP_ENTRY HalpApcInterrupt, KI_PUSH_FAKE_ERROR_CODE
51TRAP_ENTRY HalpDispatchInterrupt, KI_PUSH_FAKE_ERROR_CODE
52
53PUBLIC _ApicSpuriousService
54_ApicSpuriousService:
55    iret
56
57// VBox APIC needs an iret more or less directly following the EOI
58PUBLIC _HackEoi
59_HackEoi:
60    pushfd
61    push cs
62    push offset OnlyOnePersonKnowsHowToHackAroundVBoxBugsAndThatIsNotYou // !!
63    mov dword ptr ds:[HEX(0FFFE00B0)], 0
64    iretd
65OnlyOnePersonKnowsHowToHackAroundVBoxBugsAndThatIsNotYou:
66    ret
67
68#endif
69
70
71
72
73
74END
75