2008-03-11 02:45:13 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
2008-06-29 02:58:05 +00:00
|
|
|
* LICENSE: BSD - See COPYING.ARM in the top level directory
|
2008-03-11 02:45:13 +00:00
|
|
|
* FILE: ntoskrnl/ke/arm/trap.s
|
|
|
|
* PURPOSE: Support for exceptions and interrupts on ARM machines
|
|
|
|
* PROGRAMMERS: ReactOS Portable Systems Group
|
|
|
|
*/
|
|
|
|
|
2015-05-14 14:50:07 +00:00
|
|
|
#include <ksarm.h>
|
2008-03-11 02:45:13 +00:00
|
|
|
|
2015-05-14 14:50:07 +00:00
|
|
|
IMPORT KiUndefinedExceptionHandler
|
|
|
|
IMPORT KiSoftwareInterruptHandler
|
|
|
|
IMPORT KiPrefetchAbortHandler
|
|
|
|
IMPORT KiDataAbortHandler
|
|
|
|
IMPORT KiInterruptHandler
|
|
|
|
|
|
|
|
TEXTAREA
|
|
|
|
|
|
|
|
EXPORT KiArmVectorTable
|
|
|
|
KiArmVectorTable
|
2008-03-11 02:45:13 +00:00
|
|
|
b . // Reset
|
|
|
|
ldr pc, _KiUndefinedInstructionJump // Undefined Instruction
|
|
|
|
ldr pc, _KiSoftwareInterruptJump // Software Interrupt
|
|
|
|
ldr pc, _KiPrefetchAbortJump // Prefetch Abort
|
|
|
|
ldr pc, _KiDataAbortJump // Data Abort
|
2008-07-19 06:53:03 +00:00
|
|
|
b . // Reserved
|
2008-03-11 02:45:13 +00:00
|
|
|
ldr pc, _KiInterruptJump // Interrupt
|
|
|
|
ldr pc, _KiFastInterruptJump // Fast Interrupt
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
_KiUndefinedInstructionJump DCD KiUndefinedInstructionException
|
|
|
|
_KiSoftwareInterruptJump DCD KiSoftwareInterruptException
|
|
|
|
_KiPrefetchAbortJump DCD KiPrefetchAbortException
|
|
|
|
_KiDataAbortJump DCD KiDataAbortException
|
|
|
|
_KiInterruptJump DCD KiInterruptException
|
|
|
|
_KiFastInterruptJump DCD KiFastInterruptException
|
|
|
|
|
|
|
|
// Might need to move these to a custom header, when used by HAL as well
|
|
|
|
|
|
|
|
MACRO
|
|
|
|
TRAP_PROLOG $Abort
|
|
|
|
__debugbreak
|
|
|
|
MEND
|
|
|
|
|
|
|
|
MACRO
|
|
|
|
SYSCALL_PROLOG $Abort
|
|
|
|
__debugbreak
|
|
|
|
MEND
|
|
|
|
|
|
|
|
MACRO
|
|
|
|
TRAP_EPILOG $SystemCall
|
|
|
|
__debugbreak
|
|
|
|
MEND
|
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiUndefinedInstructionException
|
|
|
|
PROLOG_END KiUndefinedInstructionException
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap entry */
|
2008-07-19 06:53:03 +00:00
|
|
|
TRAP_PROLOG 0 // NotFromAbort
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Call the C handler */
|
2008-07-21 15:55:58 +00:00
|
|
|
ldr lr, =KiExceptionExit
|
2008-07-19 06:53:03 +00:00
|
|
|
mov r0, sp
|
|
|
|
ldr pc, =KiUndefinedExceptionHandler
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiUndefinedInstructionException
|
|
|
|
|
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiSoftwareInterruptException
|
|
|
|
PROLOG_END KiSoftwareInterruptException
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap entry */
|
- Rewrite the low-level trap/exception/system call code from the ground up:
- Do not corrupt the stack anymore
- Use a consistent trap frame layout (enable OldIrql and PreviousMode, and set the 0xBADB0D00 debug mark)
- Use slower but more correct trap prolog/epilog code for now.
- Generalize all prolog/epilog code into macros just like on x86. As a result, traps are now 6 lines of code.
- Rewrite the system call interface from the ground up:
- System calls didn't actually work: a debug print made the stack layout magical enough so that they didn't normally crush, but only slowly ate the stack.
- Copying arguments from caller to system call was, as the comment on the original code so aptly put it, "total shit".
- Due to ABI concerns, and to provide an actual template on how you're -supposed- to implement something like system calls on RISC processors, we now use
a model similar to BSD, but about ten times better (with that much less code too). We'll document it later on the RosPSG Wiki.
- This code probably contains some of the most vile-yet-elegant macro magic ever written for such low-level code as system call dispatching.
- The result of all this is that we're at the same place as before (RamdiskAddDevice needs to be implemented by the Ramdisk guys) but with a sane low-level
backend that isn't slowly eating away the stack, corrupting data, and basically working through random chance.
- Move timebase code from stubs.c to its own file, time.c.
- Silence multiple debug prints and fix a corrupted debug print in KiSystemStartup.
svn path=/trunk/; revision=34366
2008-07-08 09:11:44 +00:00
|
|
|
SYSCALL_PROLOG
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Call the C handler */
|
2008-07-21 15:55:58 +00:00
|
|
|
ldr lr, =KiServiceExit
|
2008-03-12 18:17:55 +00:00
|
|
|
mov r0, sp
|
- Rewrite the low-level trap/exception/system call code from the ground up:
- Do not corrupt the stack anymore
- Use a consistent trap frame layout (enable OldIrql and PreviousMode, and set the 0xBADB0D00 debug mark)
- Use slower but more correct trap prolog/epilog code for now.
- Generalize all prolog/epilog code into macros just like on x86. As a result, traps are now 6 lines of code.
- Rewrite the system call interface from the ground up:
- System calls didn't actually work: a debug print made the stack layout magical enough so that they didn't normally crush, but only slowly ate the stack.
- Copying arguments from caller to system call was, as the comment on the original code so aptly put it, "total shit".
- Due to ABI concerns, and to provide an actual template on how you're -supposed- to implement something like system calls on RISC processors, we now use
a model similar to BSD, but about ten times better (with that much less code too). We'll document it later on the RosPSG Wiki.
- This code probably contains some of the most vile-yet-elegant macro magic ever written for such low-level code as system call dispatching.
- The result of all this is that we're at the same place as before (RamdiskAddDevice needs to be implemented by the Ramdisk guys) but with a sane low-level
backend that isn't slowly eating away the stack, corrupting data, and basically working through random chance.
- Move timebase code from stubs.c to its own file, time.c.
- Silence multiple debug prints and fix a corrupted debug print in KiSystemStartup.
svn path=/trunk/; revision=34366
2008-07-08 09:11:44 +00:00
|
|
|
ldr pc, =KiSoftwareInterruptHandler
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiSoftwareInterruptException
|
2008-03-11 02:45:13 +00:00
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiPrefetchAbortException
|
|
|
|
PROLOG_END KiPrefetchAbortException
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap entry */
|
2008-07-13 23:32:38 +00:00
|
|
|
TRAP_PROLOG 0 // NotFromAbort
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Call the C handler */
|
2008-07-21 15:55:58 +00:00
|
|
|
ldr lr, =KiExceptionExit
|
2008-07-13 22:40:36 +00:00
|
|
|
mov r0, sp
|
|
|
|
ldr pc, =KiPrefetchAbortHandler
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiPrefetchAbortException
|
2008-03-11 02:45:13 +00:00
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiDataAbortException
|
|
|
|
PROLOG_END KiDataAbortException
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap entry */
|
- Rewrite the low-level trap/exception/system call code from the ground up:
- Do not corrupt the stack anymore
- Use a consistent trap frame layout (enable OldIrql and PreviousMode, and set the 0xBADB0D00 debug mark)
- Use slower but more correct trap prolog/epilog code for now.
- Generalize all prolog/epilog code into macros just like on x86. As a result, traps are now 6 lines of code.
- Rewrite the system call interface from the ground up:
- System calls didn't actually work: a debug print made the stack layout magical enough so that they didn't normally crush, but only slowly ate the stack.
- Copying arguments from caller to system call was, as the comment on the original code so aptly put it, "total shit".
- Due to ABI concerns, and to provide an actual template on how you're -supposed- to implement something like system calls on RISC processors, we now use
a model similar to BSD, but about ten times better (with that much less code too). We'll document it later on the RosPSG Wiki.
- This code probably contains some of the most vile-yet-elegant macro magic ever written for such low-level code as system call dispatching.
- The result of all this is that we're at the same place as before (RamdiskAddDevice needs to be implemented by the Ramdisk guys) but with a sane low-level
backend that isn't slowly eating away the stack, corrupting data, and basically working through random chance.
- Move timebase code from stubs.c to its own file, time.c.
- Silence multiple debug prints and fix a corrupted debug print in KiSystemStartup.
svn path=/trunk/; revision=34366
2008-07-08 09:11:44 +00:00
|
|
|
TRAP_PROLOG 1 // FromAbort
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Call the C handler */
|
2008-07-21 15:55:58 +00:00
|
|
|
ldr lr, =KiExceptionExit
|
2008-03-11 16:13:43 +00:00
|
|
|
mov r0, sp
|
|
|
|
ldr pc, =KiDataAbortHandler
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiDataAbortException
|
2008-03-11 02:45:13 +00:00
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiInterruptException
|
|
|
|
PROLOG_END KiInterruptException
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap entry */
|
- Rewrite the low-level trap/exception/system call code from the ground up:
- Do not corrupt the stack anymore
- Use a consistent trap frame layout (enable OldIrql and PreviousMode, and set the 0xBADB0D00 debug mark)
- Use slower but more correct trap prolog/epilog code for now.
- Generalize all prolog/epilog code into macros just like on x86. As a result, traps are now 6 lines of code.
- Rewrite the system call interface from the ground up:
- System calls didn't actually work: a debug print made the stack layout magical enough so that they didn't normally crush, but only slowly ate the stack.
- Copying arguments from caller to system call was, as the comment on the original code so aptly put it, "total shit".
- Due to ABI concerns, and to provide an actual template on how you're -supposed- to implement something like system calls on RISC processors, we now use
a model similar to BSD, but about ten times better (with that much less code too). We'll document it later on the RosPSG Wiki.
- This code probably contains some of the most vile-yet-elegant macro magic ever written for such low-level code as system call dispatching.
- The result of all this is that we're at the same place as before (RamdiskAddDevice needs to be implemented by the Ramdisk guys) but with a sane low-level
backend that isn't slowly eating away the stack, corrupting data, and basically working through random chance.
- Move timebase code from stubs.c to its own file, time.c.
- Silence multiple debug prints and fix a corrupted debug print in KiSystemStartup.
svn path=/trunk/; revision=34366
2008-07-08 09:11:44 +00:00
|
|
|
TRAP_PROLOG 0 // NotFromAbort
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Call the C handler */
|
2008-07-21 15:55:58 +00:00
|
|
|
ldr lr, =KiExceptionExit
|
2008-06-11 16:48:07 +00:00
|
|
|
mov r0, sp
|
|
|
|
mov r1, #0
|
|
|
|
ldr pc, =KiInterruptHandler
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiInterruptException
|
2008-03-11 02:45:13 +00:00
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiFastInterruptException
|
|
|
|
PROLOG_END KiFastInterruptException
|
2015-05-14 14:50:07 +00:00
|
|
|
|
2008-07-19 06:53:03 +00:00
|
|
|
// FIXME-PERF: Implement FIQ exception
|
2015-05-14 14:50:07 +00:00
|
|
|
__debugbreak
|
|
|
|
|
|
|
|
NESTED_END KiFastInterruptException
|
|
|
|
|
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
NESTED_ENTRY KiExceptionExit
|
|
|
|
PROLOG_END KiExceptionExit
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap exit */
|
2008-07-21 15:55:58 +00:00
|
|
|
TRAP_EPILOG 0 // NotFromSystemCall
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiExceptionExit
|
2008-07-21 15:55:58 +00:00
|
|
|
|
|
|
|
NESTED_ENTRY KiServiceExit
|
|
|
|
PROLOG_END KiServiceExit
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
/* Handle trap exit */
|
2008-07-21 15:55:58 +00:00
|
|
|
TRAP_EPILOG 1 // FromSystemCall
|
2015-05-14 14:50:07 +00:00
|
|
|
|
|
|
|
NESTED_END KiServiceExit
|
|
|
|
|
|
|
|
|
|
|
|
LEAF_ENTRY KiInterruptTemplate
|
|
|
|
DCD 0
|
|
|
|
LEAF_END KiInterruptTemplate
|
|
|
|
|
|
|
|
END
|
|
|
|
/* EOF */
|