xref: /reactos/ntoskrnl/ke/arm/trap.s (revision 8a978a17)
1/*
2 * PROJECT:         ReactOS Kernel
3 * LICENSE:         BSD - See COPYING.ARM in the top level directory
4 * FILE:            ntoskrnl/ke/arm/trap.s
5 * PURPOSE:         Support for exceptions and interrupts on ARM machines
6 * PROGRAMMERS:     ReactOS Portable Systems Group
7 */
8
9#include <ksarm.h>
10
11    IMPORT KiUndefinedExceptionHandler
12    IMPORT KiSoftwareInterruptHandler
13    IMPORT KiPrefetchAbortHandler
14    IMPORT KiDataAbortHandler
15    IMPORT KiInterruptHandler
16
17    TEXTAREA
18
19    EXPORT KiArmVectorTable
20KiArmVectorTable
21        b .                                     // Reset
22        ldr pc, _KiUndefinedInstructionJump     // Undefined Instruction
23        ldr pc, _KiSoftwareInterruptJump        // Software Interrupt
24        ldr pc, _KiPrefetchAbortJump            // Prefetch Abort
25        ldr pc, _KiDataAbortJump                // Data Abort
26        b .                                     // Reserved
27        ldr pc, _KiInterruptJump                // Interrupt
28        ldr pc, _KiFastInterruptJump            // Fast Interrupt
29
30_KiUndefinedInstructionJump    DCD KiUndefinedInstructionException
31_KiSoftwareInterruptJump       DCD KiSoftwareInterruptException
32_KiPrefetchAbortJump           DCD KiPrefetchAbortException
33_KiDataAbortJump               DCD KiDataAbortException
34_KiInterruptJump               DCD KiInterruptException
35_KiFastInterruptJump           DCD KiFastInterruptException
36
37    // Might need to move these to a custom header, when used by HAL as well
38
39    MACRO
40    TRAP_PROLOG $Abort
41        __debugbreak
42    MEND
43
44    MACRO
45    SYSCALL_PROLOG $Abort
46        __debugbreak
47    MEND
48
49    MACRO
50    TRAP_EPILOG $SystemCall
51        __debugbreak
52    MEND
53
54    NESTED_ENTRY KiUndefinedInstructionException
55    PROLOG_END KiUndefinedInstructionException
56
57    /* Handle trap entry */
58    TRAP_PROLOG 0 // NotFromAbort
59
60    /* Call the C handler */
61    ldr lr, =KiExceptionExit
62    mov r0, sp
63    ldr pc, =KiUndefinedExceptionHandler
64
65    NESTED_END KiUndefinedInstructionException
66
67
68    NESTED_ENTRY KiSoftwareInterruptException
69    PROLOG_END KiSoftwareInterruptException
70
71    /* Handle trap entry */
72    SYSCALL_PROLOG
73
74    /* Call the C handler */
75    ldr lr, =KiServiceExit
76    mov r0, sp
77    ldr pc, =KiSoftwareInterruptHandler
78
79    NESTED_END KiSoftwareInterruptException
80
81
82    NESTED_ENTRY KiPrefetchAbortException
83    PROLOG_END KiPrefetchAbortException
84
85    /* Handle trap entry */
86    TRAP_PROLOG 0 // NotFromAbort
87
88    /* Call the C handler */
89    ldr lr, =KiExceptionExit
90    mov r0, sp
91    ldr pc, =KiPrefetchAbortHandler
92
93    NESTED_END KiPrefetchAbortException
94
95
96    NESTED_ENTRY KiDataAbortException
97    PROLOG_END KiDataAbortException
98
99    /* Handle trap entry */
100    TRAP_PROLOG 1 // FromAbort
101
102    /* Call the C handler */
103    ldr lr, =KiExceptionExit
104    mov r0, sp
105    ldr pc, =KiDataAbortHandler
106
107    NESTED_END KiDataAbortException
108
109
110    NESTED_ENTRY KiInterruptException
111    PROLOG_END KiInterruptException
112
113    /* Handle trap entry */
114    TRAP_PROLOG 0 // NotFromAbort
115
116    /* Call the C handler */
117    ldr lr, =KiExceptionExit
118    mov r0, sp
119    mov r1, #0
120    ldr pc, =KiInterruptHandler
121
122    NESTED_END KiInterruptException
123
124
125    NESTED_ENTRY KiFastInterruptException
126    PROLOG_END KiFastInterruptException
127
128    // FIXME-PERF: Implement FIQ exception
129    __debugbreak
130
131    NESTED_END KiFastInterruptException
132
133
134    NESTED_ENTRY KiExceptionExit
135    PROLOG_END KiExceptionExit
136
137    /* Handle trap exit */
138    TRAP_EPILOG 0 // NotFromSystemCall
139
140    NESTED_END KiExceptionExit
141
142    NESTED_ENTRY KiServiceExit
143    PROLOG_END KiServiceExit
144
145    /* Handle trap exit */
146    TRAP_EPILOG 1 // FromSystemCall
147
148    NESTED_END KiServiceExit
149
150
151    LEAF_ENTRY KiInterruptTemplate
152    DCD 0
153    LEAF_END KiInterruptTemplate
154
155    END
156/* EOF */
157