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
|
|
|
|
*/
|
|
|
|
|
|
|
|
.title "ARM Trap Dispatching and Handling"
|
- 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
|
|
|
#include "ntoskrnl/include/internal/arm/kxarm.h"
|
2008-03-11 02:45:13 +00:00
|
|
|
.include "ntoskrnl/include/internal/arm/ksarm.h"
|
|
|
|
|
|
|
|
.global KiArmVectorTable
|
|
|
|
KiArmVectorTable:
|
|
|
|
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
|
|
|
|
|
|
|
|
_KiUndefinedInstructionJump: .word KiUndefinedInstructionException
|
|
|
|
_KiSoftwareInterruptJump: .word KiSoftwareInterruptException
|
|
|
|
_KiPrefetchAbortJump: .word KiPrefetchAbortException
|
|
|
|
_KiDataAbortJump: .word KiDataAbortException
|
|
|
|
_KiInterruptJump: .word KiInterruptException
|
|
|
|
_KiFastInterruptJump: .word KiFastInterruptException
|
- 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
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
TEXTAREA
|
|
|
|
NESTED_ENTRY KiUndefinedInstructionException
|
|
|
|
PROLOG_END KiUndefinedInstructionException
|
|
|
|
//
|
2008-07-19 06:53:03 +00:00
|
|
|
// Handle trap entry
|
2008-03-11 02:45:13 +00:00
|
|
|
//
|
2008-07-19 06:53:03 +00:00
|
|
|
TRAP_PROLOG 0 // NotFromAbort
|
|
|
|
|
|
|
|
//
|
|
|
|
// 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
|
2008-03-11 02:45:13 +00:00
|
|
|
ENTRY_END KiUndefinedInstructionException
|
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiSoftwareInterruptException
|
|
|
|
PROLOG_END KiSoftwareInterruptException
|
2008-03-12 18:17:55 +00:00
|
|
|
//
|
- 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
|
|
|
// Handle trap entry
|
2008-06-11 18:39:44 +00:00
|
|
|
//
|
- 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
|
2008-06-11 18:39:44 +00:00
|
|
|
|
2008-03-12 18:17:55 +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
|
2008-03-11 02:45:13 +00:00
|
|
|
ENTRY_END KiSoftwareInterruptException
|
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiPrefetchAbortException
|
|
|
|
PROLOG_END KiPrefetchAbortException
|
|
|
|
//
|
2008-07-13 22:40:36 +00:00
|
|
|
// Handle trap entry
|
2008-03-11 02:45:13 +00:00
|
|
|
//
|
2008-07-13 23:32:38 +00:00
|
|
|
TRAP_PROLOG 0 // NotFromAbort
|
2008-07-13 22:40:36 +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
|
2008-03-11 02:45:13 +00:00
|
|
|
ENTRY_END KiPrefetchAbortException
|
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiDataAbortException
|
|
|
|
PROLOG_END KiDataAbortException
|
|
|
|
//
|
- 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
|
|
|
// Handle trap entry
|
2008-03-11 16:13:43 +00:00
|
|
|
//
|
- 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
|
2008-03-11 16:13:43 +00:00
|
|
|
|
2008-03-11 02:45:13 +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
|
2008-03-11 02:45:13 +00:00
|
|
|
ENTRY_END KiDataAbortException
|
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiInterruptException
|
|
|
|
PROLOG_END KiInterruptException
|
2008-06-11 16:48:07 +00:00
|
|
|
//
|
- 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
|
|
|
// Handle trap entry
|
2008-06-11 16:48:07 +00:00
|
|
|
//
|
- 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
|
2008-06-11 18:39:44 +00:00
|
|
|
|
2008-06-11 16:48: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
|
2008-03-11 02:45:13 +00:00
|
|
|
ENTRY_END KiInterruptException
|
|
|
|
|
2008-07-21 15:55:58 +00:00
|
|
|
|
2008-03-11 02:45:13 +00:00
|
|
|
NESTED_ENTRY KiFastInterruptException
|
|
|
|
PROLOG_END KiFastInterruptException
|
|
|
|
//
|
2008-07-19 06:53:03 +00:00
|
|
|
// FIXME-PERF: Implement FIQ exception
|
2008-03-11 02:45:13 +00:00
|
|
|
//
|
|
|
|
b .
|
|
|
|
ENTRY_END KiFastInterruptException
|
2008-07-21 15:55:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
NESTED_ENTRY KiExceptionExit
|
|
|
|
PROLOG_END KiExceptionExit
|
|
|
|
//
|
|
|
|
// Handle trap exit
|
|
|
|
//
|
|
|
|
TRAP_EPILOG 0 // NotFromSystemCall
|
|
|
|
ENTRY_END KiExceptionExit
|
|
|
|
|
|
|
|
NESTED_ENTRY KiServiceExit
|
|
|
|
PROLOG_END KiServiceExit
|
|
|
|
//
|
|
|
|
// Handle trap exit
|
|
|
|
//
|
|
|
|
TRAP_EPILOG 1 // FromSystemCall
|
|
|
|
ENTRY_END KiServiceExit
|