reactos/ntoskrnl/ke/arm/ke_i.h

105 lines
2.2 KiB
C
Raw Normal View History

- 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
/*
* PROJECT: ReactOS Kernel
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: ntoskrnl/ke/arm/ke_i.h
* PURPOSE: Implements macro-generated system call portable wrappers
* PROGRAMMERS: ReactOS Portable Systems Group
*/
//
// First, cleanup after any previous invocation
//
#undef _1
#undef _2
#undef _3
#undef _4
#undef _5
#undef _6
#undef _7
#undef _8
#undef _9
#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef _10
#undef _11
#undef SYSCALL
//
// Are we building the typedef prototypes?
//
#ifdef PROTO
//
// Then, each parameter is actually a prototype argument
//
#define _1 PVOID
#define _2 PVOID
#define _3 PVOID
#define _4 PVOID
#define _5 PVOID
#define _6 PVOID
#define _7 PVOID
#define _8 PVOID
#define _9 PVOID
#define a PVOID
#define b PVOID
#define c PVOID
#define d PVOID
#define e PVOID
#define f PVOID
#define _10 PVOID
#define _11 PVOID
//
// And we generate the typedef
//
#define SYSCALL(x, y) typedef NTSTATUS (*PKI_SYSCALL_##x##PARAM)y;
//
// Cleanup for next run
//
#undef PROTO
#else
//
// Each parameter is actually an argument for the system call
//
#define _1 g[0x00]
#define _2 g[0x01]
#define _3 g[0x02]
#define _4 g[0x03]
#define _5 g[0x04]
#define _6 g[0x05]
#define _7 g[0x06]
#define _8 g[0x07]
#define _9 g[0x08]
#define a g[0x09]
#define b g[0x0A]
#define c g[0x0B]
#define d g[0x0C]
#define e g[0x0D]
#define f g[0x0E]
#define _10 g[0x0F]
#define _11 g[0x10]
//
// And we generate the actual system call
//
#define SYSCALL(x, y) \
NTSTATUS \
KiSyscall##x##Param( \
IN PVOID p, \
IN PVOID *g \
) \
{ \
return ((PKI_SYSCALL_##x##PARAM)p)y; \
}
//
// Cleanup for next run
//
#undef FUNC
#endif