[ros-diffs] [ros-arm-bringup] 32134: Implement ARM version of DbgBreakPoint in the RTL. We do a bkpt with a special value of 3 (to be as close as possible to x86 int 3). Fix NtCurrentTeb definition for ARM. We will expose the KPCR to user-mode much like KUSER_SHARED_DATA on x86 (this is how ARM-CE and NT-MIPS do it) and link the TEB there.

ros-arm-bringup at svn.reactos.org ros-arm-bringup at svn.reactos.org
Tue Feb 5 12:08:35 CET 2008


Author: ros-arm-bringup
Date: Tue Feb  5 14:08:34 2008
New Revision: 32134

URL: http://svn.reactos.org/svn/reactos?rev=32134&view=rev
Log:
Implement ARM version of DbgBreakPoint in the RTL. We do a bkpt with a special value of 3 (to be as close as possible to x86 int 3).
Fix NtCurrentTeb definition for ARM. We will expose the KPCR to user-mode much like KUSER_SHARED_DATA on x86 (this is how ARM-CE and NT-MIPS do it) and link the TEB there.


Added:
    trunk/reactos/lib/rtl/arm/
    trunk/reactos/lib/rtl/arm/debug_asm.S   (with props)
Modified:
    trunk/reactos/include/ndk/arm/ketypes.h
    trunk/reactos/include/psdk/winnt.h
    trunk/reactos/lib/rtl/rtl.rbuild

Modified: trunk/reactos/include/ndk/arm/ketypes.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/arm/ketypes.h?rev=32134&r1=32133&r2=32134&view=diff
==============================================================================
--- trunk/reactos/include/ndk/arm/ketypes.h (original)
+++ trunk/reactos/include/ndk/arm/ketypes.h Tue Feb  5 14:08:34 2008
@@ -66,7 +66,9 @@
 // FIXME: mmtypes.h?
 //
 #define KIPCR                   0xFFFFF000
-#define PCR                     ((volatile KPCR * const)KIPCR)
+#define USPCR                   0x7FFF0000
+#define PCR                     ((volatile KPCR * const)USPCR)
+#define USERPCR                 ((volatile KPCR * const)KIPCR)
 
 //
 // Synchronization-level IRQL
@@ -104,34 +106,13 @@
     ULONG FpExtra[8];
 } KTRAP_FRAME, *PKTRAP_FRAME;
 
-#ifndef NTOS_MODE_USER
-//
-// Stub
-//
-typedef struct _KFLOATING_SAVE
-{
-    ULONG Reserved;
-} KFLOATING_SAVE, *PKFLOATING_SAVE;
-
-//
-// Processor Region Control Block
-//
-typedef struct _KPRCB
-{
-    USHORT MinorVersion;
-    USHORT MajorVersion;
-    struct _KTHREAD *CurrentThread;
-    struct _KTHREAD *NextThread;
-    struct _KTHREAD *IdleThread;
-    UCHAR Number;
-    //
-    // TODO
-    //
-} KPRCB, *PKPRCB;
-
 //
 // Processor Control Region
-//
+// On ARM, it's actually readable from user-mode, much like KUSER_SHARED_DATA
+//
+#ifdef NTOS_MODE_USER
+#define PKINTERRUPT_ROUTINE PVOID // Hack!
+#endif
 typedef struct _KPCR
 {
     ULONG MinorVersion;
@@ -186,6 +167,31 @@
     ULONG QuantumEnd;
 } KPCR, *PKPCR;
 
+#ifndef NTOS_MODE_USER
+//
+// Stub
+//
+typedef struct _KFLOATING_SAVE
+{
+    ULONG Reserved;
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+//
+// Processor Region Control Block
+//
+typedef struct _KPRCB
+{
+    USHORT MinorVersion;
+    USHORT MajorVersion;
+    struct _KTHREAD *CurrentThread;
+    struct _KTHREAD *NextThread;
+    struct _KTHREAD *IdleThread;
+    UCHAR Number;
+    //
+    // TODO
+    //
+} KPRCB, *PKPRCB;
+
 //
 // Macro to get current KPRCB
 //

Modified: trunk/reactos/include/psdk/winnt.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winnt.h?rev=32134&r1=32133&r2=32134&view=diff
==============================================================================
--- trunk/reactos/include/psdk/winnt.h (original)
+++ trunk/reactos/include/psdk/winnt.h Tue Feb  5 14:08:34 2008
@@ -4104,7 +4104,23 @@
     return ret;
 }
 #elif _M_ARM
-    struct _TEB* WINAPI NtCurrentTeb(VOID);
+    
+//
+// NT-ARM is not documented, need NDK
+//
+#define NTOS_MODE_USER
+#include <arm/ketypes.h>
+    
+//
+// FIXME: Move _M_ARM stuff away from here
+// *** AND NOT IN THE NDK! NDK IS ONLY FOR OFFICIALLY OBTAINABLE/EXISTING NT
+//
+FORCEINLINE
+struct _TEB* NtCurrentTeb(VOID)
+{
+    return (struct _TEB*)USERPCR->Teb;
+}
+
 #else
 static __inline__ struct _TEB * NtCurrentTeb(void)
 {

Added: trunk/reactos/lib/rtl/arm/debug_asm.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/arm/debug_asm.S?rev=32134&view=auto
==============================================================================
--- trunk/reactos/lib/rtl/arm/debug_asm.S (added)
+++ trunk/reactos/lib/rtl/arm/debug_asm.S Tue Feb  5 14:08:34 2008
@@ -1,0 +1,18 @@
+/*
+ * COPYRIGHT:         See COPYING in the top level directory
+ * PROJECT:           ReactOS Run-Time Library
+ * PURPOSE:           Debug Routines
+ * FILE:              lib/rtl/arm/debug_asm.S
+ */
+
+/* GLOBALS ********************************************************************/
+
+.globl DbgBreakPoint
+
+/* FUNCTIONS ******************************************************************/
+
+.func DbgBreakPoint
+DbgBreakPoint:
+    bkpt 3
+    bx lr
+.endfunc

Propchange: trunk/reactos/lib/rtl/arm/debug_asm.S
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: trunk/reactos/lib/rtl/arm/debug_asm.S
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: trunk/reactos/lib/rtl/rtl.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/rtl.rbuild?rev=32134&r1=32133&r2=32134&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/rtl.rbuild (original)
+++ trunk/reactos/lib/rtl/rtl.rbuild Tue Feb  5 14:08:34 2008
@@ -28,6 +28,11 @@
 		<file>rtlswap.s</file>
 		<file>thread.c</file>
 	</directory>
+   	</if>
+	<if property="ARCH" value="arm">
+		<directory name="arm">
+			<file>debug_asm.S</file>
+		</directory>
 	</if>
 	<directory name="austin">
 		<file>avl.c</file>




More information about the Ros-diffs mailing list