Author: tkreuzer
Date: Sat Dec 6 12:31:33 2008
New Revision: 37902
URL:
http://svn.reactos.org/svn/reactos?rev=37902&view=rev
Log:
- move CONTEXT stuff from wdm.h to winddk.h / armddk.h
- inlcude intrin.h in wdm.h
- avoid redefining PCONTEXT
- use intrinsics for BitScanForward/Reverse
Modified:
trunk/reactos/include/ddk/wdm.h
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/psdk/winnt.h
trunk/reactos/include/reactos/arm/armddk.h
Modified: trunk/reactos/include/ddk/wdm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=3790…
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Sat Dec 6 12:31:33 2008
@@ -9,7 +9,11 @@
#include <ntdef.h>
#include <ntstatus.h>
-
+#ifdef __GNUC__
+#include "intrin.h"
+#endif
+
+typedef struct _CONTEXT *PCONTEXT;
//
// Resource list definitions
@@ -582,131 +586,6 @@
#define SERVICE_DEMAND_START 0x00000003
#define SERVICE_DISABLED 0x00000004
-
-
-//
-// Architecture Defined Contexts
-//
-#if defined(_M_IX86)
-#define SIZE_OF_80387_REGISTERS 80
-#define CONTEXT_i386 0x10000
-#define CONTEXT_i486 0x10000
-#define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
-#define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
-#define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
-#define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
-#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
-#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
-#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
-#define MAXIMUM_SUPPORTED_EXTENSION 512
-
-#define EXCEPTION_READ_FAULT 0
-#define EXCEPTION_WRITE_FAULT 1
-#define EXCEPTION_EXECUTE_FAULT 8
-
-typedef struct _FLOATING_SAVE_AREA {
- ULONG ControlWord;
- ULONG StatusWord;
- ULONG TagWord;
- ULONG ErrorOffset;
- ULONG ErrorSelector;
- ULONG DataOffset;
- ULONG DataSelector;
- UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
- ULONG Cr0NpxState;
-} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
-
-typedef struct _CONTEXT {
- ULONG ContextFlags;
- ULONG Dr0;
- ULONG Dr1;
- ULONG Dr2;
- ULONG Dr3;
- ULONG Dr6;
- ULONG Dr7;
- FLOATING_SAVE_AREA FloatSave;
- ULONG SegGs;
- ULONG SegFs;
- ULONG SegEs;
- ULONG SegDs;
- ULONG Edi;
- ULONG Esi;
- ULONG Ebx;
- ULONG Edx;
- ULONG Ecx;
- ULONG Eax;
- ULONG Ebp;
- ULONG Eip;
- ULONG SegCs;
- ULONG EFlags;
- ULONG Esp;
- ULONG SegSs;
- UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
-} CONTEXT, *PCONTEXT;
-
-#elif defined(_M_AMD64)
-#error FIXME-TODO: 64-bit
-#elif defined(_M_ARM)
-
-//
-// FIXME: Move to armddk.h?
-//
-
-/* The following flags control the contents of the CONTEXT structure. */
-
-#define CONTEXT_ARM 0x0000040
-#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
-#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
-
-#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
-
-typedef struct _CONTEXT {
- /* The flags values within this flag control the contents of
- a CONTEXT record.
-
- If the context record is used as an input parameter, then
- for each portion of the context record controlled by a flag
- whose value is set, it is assumed that that portion of the
- context record contains valid context. If the context record
- is being used to modify a thread's context, then only that
- portion of the threads context will be modified.
-
- If the context record is used as an IN OUT parameter to capture
- the context of a thread, then only those portions of the thread's
- context corresponding to set flags will be returned.
-
- The context record is never used as an OUT only parameter. */
-
- ULONG ContextFlags;
-
- /* This section is specified/returned if the ContextFlags word contains
- the flag CONTEXT_INTEGER. */
- ULONG R0;
- ULONG R1;
- ULONG R2;
- ULONG R3;
- ULONG R4;
- ULONG R5;
- ULONG R6;
- ULONG R7;
- ULONG R8;
- ULONG R9;
- ULONG R10;
- ULONG R11;
- ULONG R12;
-
- ULONG Sp;
- ULONG Lr;
- ULONG Pc;
- ULONG Psr;
-} CONTEXT, *PCONTEXT;
-
-#else
-#error "Undefined processor architecture"
-#endif
-
-
-
//
// Exception Records
//
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=3…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Sat Dec 6 12:31:33 2008
@@ -214,6 +214,10 @@
#define KERNEL_STACK_SIZE 12288
#define KERNEL_LARGE_STACK_SIZE 61440
#define KERNEL_LARGE_STACK_COMMIT 12288
+
+#define EXCEPTION_READ_FAULT 0
+#define EXCEPTION_WRITE_FAULT 1
+#define EXCEPTION_EXECUTE_FAULT 8
#define DPFLTR_ERROR_LEVEL 0
#define DPFLTR_WARNING_LEVEL 1
@@ -5448,6 +5452,58 @@
#ifdef _X86_
+#define SIZE_OF_80387_REGISTERS 80
+#define CONTEXT_i386 0x10000
+#define CONTEXT_i486 0x10000
+#define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
+#define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
+#define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
+#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
+#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
+#define MAXIMUM_SUPPORTED_EXTENSION 512
+
+typedef struct _FLOATING_SAVE_AREA {
+ ULONG ControlWord;
+ ULONG StatusWord;
+ ULONG TagWord;
+ ULONG ErrorOffset;
+ ULONG ErrorSelector;
+ ULONG DataOffset;
+ ULONG DataSelector;
+ UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
+ ULONG Cr0NpxState;
+} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
+
+typedef struct _CONTEXT {
+ ULONG ContextFlags;
+ ULONG Dr0;
+ ULONG Dr1;
+ ULONG Dr2;
+ ULONG Dr3;
+ ULONG Dr6;
+ ULONG Dr7;
+ FLOATING_SAVE_AREA FloatSave;
+ ULONG SegGs;
+ ULONG SegFs;
+ ULONG SegEs;
+ ULONG SegDs;
+ ULONG Edi;
+ ULONG Esi;
+ ULONG Ebx;
+ ULONG Edx;
+ ULONG Ecx;
+ ULONG Eax;
+ ULONG Ebp;
+ ULONG Eip;
+ ULONG SegCs;
+ ULONG EFlags;
+ ULONG Esp;
+ ULONG SegSs;
+ UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
+} CONTEXT;
+
//
// Types to use to contain PFNs and their counts.
//
Modified: trunk/reactos/include/psdk/winnt.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=3…
==============================================================================
--- trunk/reactos/include/psdk/winnt.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/winnt.h [iso-8859-1] Sat Dec 6 12:31:33 2008
@@ -2229,7 +2229,7 @@
DWORD64 LastBranchFromRip;
DWORD64 LastExceptionToRip;
DWORD64 LastExceptionFromRip;
-} CONTEXT, *PCONTEXT;
+} CONTEXT;
typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
@@ -2299,7 +2299,7 @@
NTSYSAPI
VOID
__cdecl
-RtlRestoreContext(PCONTEXT ContextRecord,
+RtlRestoreContext(struct _CONTEXT *ContextRecord,
struct _EXCEPTION_RECORD *ExceptionRecord);
NTSYSAPI
@@ -4796,29 +4796,8 @@
#endif
}
-static __inline__ BOOLEAN
-BitScanReverse(OUT ULONG *Index,
- IN ULONG Mask)
-{
- BOOLEAN BitPosition = 0;
-#if defined(_M_IX86)
- __asm__ __volatile__("bsrl %2,%0\n\t"
- "setnz %1\n\t"
- :"=&r" (*Index), "=q" (BitPosition)
- :"rm" (Mask)
- :"memory");
- return BitPosition;
-#else
- /* Slow implementation for now */
- for( *Index = 31; *Index; (*Index)-- ) {
- if( (1<<*Index) & Mask ) {
- return TRUE;
- }
- }
-
- return FALSE;
-#endif
-}
+#define BitScanForward _BitScanForward
+#define BitScanReverse _BitScanReverse
#endif
Modified: trunk/reactos/include/reactos/arm/armddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/arm/armddk…
==============================================================================
--- trunk/reactos/include/reactos/arm/armddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/arm/armddk.h [iso-8859-1] Sat Dec 6 12:31:33 2008
@@ -57,6 +57,53 @@
{
ULONG Reserved;
} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+/* The following flags control the contents of the CONTEXT structure. */
+#define CONTEXT_ARM 0x0000040
+#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
+#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
+
+typedef struct _CONTEXT {
+ /* The flags values within this flag control the contents of
+ a CONTEXT record.
+
+ If the context record is used as an input parameter, then
+ for each portion of the context record controlled by a flag
+ whose value is set, it is assumed that that portion of the
+ context record contains valid context. If the context record
+ is being used to modify a thread's context, then only that
+ portion of the threads context will be modified.
+
+ If the context record is used as an IN OUT parameter to capture
+ the context of a thread, then only those portions of the thread's
+ context corresponding to set flags will be returned.
+
+ The context record is never used as an OUT only parameter. */
+
+ ULONG ContextFlags;
+
+ /* This section is specified/returned if the ContextFlags word contains
+ the flag CONTEXT_INTEGER. */
+ ULONG R0;
+ ULONG R1;
+ ULONG R2;
+ ULONG R3;
+ ULONG R4;
+ ULONG R5;
+ ULONG R6;
+ ULONG R7;
+ ULONG R8;
+ ULONG R9;
+ ULONG R10;
+ ULONG R11;
+ ULONG R12;
+
+ ULONG Sp;
+ ULONG Lr;
+ ULONG Pc;
+ ULONG Psr;
+} CONTEXT;
//
// Processor Control Region