- Rewrite the low-level trap/exception/system call code from the ground up:
[reactos.git] / reactos / ntoskrnl / ke / arm / trap.s
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 .title "ARM Trap Dispatching and Handling"
10 #include "ntoskrnl/include/internal/arm/kxarm.h"
11 .include "ntoskrnl/include/internal/arm/ksarm.h"
12
13 .global KiArmVectorTable
14 KiArmVectorTable:
15 b . // Reset
16 ldr pc, _KiUndefinedInstructionJump // Undefined Instruction
17 ldr pc, _KiSoftwareInterruptJump // Software Interrupt
18 ldr pc, _KiPrefetchAbortJump // Prefetch Abort
19 ldr pc, _KiDataAbortJump // Data Abort
20 ldr pc, _KiReservedJump // Reserved
21 ldr pc, _KiInterruptJump // Interrupt
22 ldr pc, _KiFastInterruptJump // Fast Interrupt
23
24 _KiUndefinedInstructionJump: .word KiUndefinedInstructionException
25 _KiSoftwareInterruptJump: .word KiSoftwareInterruptException
26 _KiPrefetchAbortJump: .word KiPrefetchAbortException
27 _KiDataAbortJump: .word KiDataAbortException
28 _KiReservedJump: .word KiReservedException
29 _KiInterruptJump: .word KiInterruptException
30 _KiFastInterruptJump: .word KiFastInterruptException
31
32 TEXTAREA
33 NESTED_ENTRY KiUndefinedInstructionException
34 PROLOG_END KiUndefinedInstructionException
35
36 //
37 // FIXME: TODO
38 //
39 b .
40
41 ENTRY_END KiUndefinedInstructionException
42
43 NESTED_ENTRY KiSoftwareInterruptException
44 PROLOG_END KiSoftwareInterruptException
45
46 //
47 // Handle trap entry
48 //
49 SYSCALL_PROLOG
50
51 //
52 // Call the C handler
53 //
54 adr lr, 1f
55 mov r0, sp
56 ldr pc, =KiSoftwareInterruptHandler
57
58 1:
59 //
60 // Handle trap exit
61 //
62 TRAP_EPILOG 1 // FromSystemCall
63
64 ENTRY_END KiSoftwareInterruptException
65
66 NESTED_ENTRY KiPrefetchAbortException
67 PROLOG_END KiPrefetchAbortException
68
69 //
70 // FIXME: TODO
71 //
72 b .
73
74 ENTRY_END KiPrefetchAbortException
75
76 NESTED_ENTRY KiDataAbortException
77 PROLOG_END KiDataAbortException
78
79 //
80 // Handle trap entry
81 //
82 TRAP_PROLOG 1 // FromAbort
83
84 //
85 // Call the C handler
86 //
87 adr lr, 1f
88 mov r0, sp
89 ldr pc, =KiDataAbortHandler
90
91 1:
92 //
93 // Handle trap exit
94 //
95 TRAP_EPILOG 0 // NotFromSystemCall
96
97 ENTRY_END KiDataAbortException
98
99 NESTED_ENTRY KiInterruptException
100 PROLOG_END KiInterruptException
101
102 //
103 // Handle trap entry
104 //
105 TRAP_PROLOG 0 // NotFromAbort
106
107 //
108 // Call the C handler
109 //
110 adr lr, 1f
111 mov r0, sp
112 mov r1, #0
113 ldr pc, =KiInterruptHandler
114
115 1:
116 //
117 // Handle trap exit
118 //
119 TRAP_EPILOG 0 // NotFromSystemCall
120
121 ENTRY_END KiInterruptException
122
123 NESTED_ENTRY KiFastInterruptException
124 PROLOG_END KiFastInterruptException
125
126 //
127 // FIXME: TODO
128 //
129 b .
130
131 ENTRY_END KiFastInterruptException
132
133
134 NESTED_ENTRY KiReservedException
135 PROLOG_END KiReservedException
136
137 //
138 // FIXME: TODO
139 //
140 b .
141
142 ENTRY_END KiReservedException