- Cleanup assembly files and create a header for the macros added and new ones that...
authorAlex Ionescu <aionescu@gmail.com>
Sat, 31 Dec 2005 00:03:19 +0000 (00:03 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Sat, 31 Dec 2005 00:03:19 +0000 (00:03 +0000)
svn path=/trunk/; revision=20476

reactos/ntoskrnl/ex/i386/fastinterlck_asm.S
reactos/ntoskrnl/ex/i386/interlck_asm.S
reactos/ntoskrnl/include/internal/i386/asmmacro.S [new file with mode: 0644]

index 89cc878..3bfc090 100644 (file)
@@ -8,28 +8,9 @@
  \r
 /* INCLUDES ******************************************************************/\r
 #include <ndk/asm.h>\r
+#include <internal/i386/asmmacro.S>\r
 .intel_syntax noprefix\r
 \r
-//#define CONFIG_SMP\r
-\r
-#ifdef CONFIG_SMP\r
-#define LOCK lock\r
-#define ACQUIRE_SPINLOCK(x, y) \\r
-    lock bts dword ptr [x], 0; \\r
-    jb y\r
-#define RELEASE_SPINLOCK(x) mov byte ptr [x], 0\r
-#define SPIN_ON_LOCK(x, y) \\r
-1: \\r
-    test dword ptr [x], 1; \\r
-    jz y; \\r
-    pause; \\r
-    jmp 1b\r
-#else\r
-#define LOCK\r
-#define ACQUIRE_SPINLOCK(x, y)\r
-#define RELEASE_SPINLOCK(x) \r
-#endif\r
-\r
 /* FUNCTIONS ****************************************************************/\r
 \r
 /*\r
index 9ba31c7..0a81f48 100644 (file)
@@ -8,28 +8,9 @@
  \r
 /* INCLUDES ******************************************************************/\r
 #include <ndk/asm.h>\r
+#include <internal/i386/asmmacro.S>\r
 .intel_syntax noprefix\r
 \r
-//#define CONFIG_SMP\r
-\r
-#ifdef CONFIG_SMP\r
-#define LOCK lock\r
-#define ACQUIRE_SPINLOCK(x, y) \\r
-    lock bts dword ptr [x], 0; \\r
-    jb y\r
-#define RELEASE_SPINLOCK(x) mov byte ptr [x], 0\r
-#define SPIN_ON_LOCK(x, y) \\r
-1: \\r
-    test dword ptr [x], 1; \\r
-    jz y; \\r
-    pause; \\r
-    jmp 1b\r
-#else\r
-#define LOCK\r
-#define ACQUIRE_SPINLOCK(x, y)\r
-#define RELEASE_SPINLOCK(x) \r
-#endif\r
-\r
 /* FUNCTIONS ****************************************************************/\r
 \r
 /*\r
diff --git a/reactos/ntoskrnl/include/internal/i386/asmmacro.S b/reactos/ntoskrnl/include/internal/i386/asmmacro.S
new file mode 100644 (file)
index 0000000..45c7a9c
--- /dev/null
@@ -0,0 +1,52 @@
+/*\r
+ * COPYRIGHT:       See COPYING in the top level directory\r
+ * PROJECT:         ReactOS kernel\r
+ * FILE:            ntoskrnlinclude/i386/asmmacro.S\r
+ * PURPOSE:         Assembly Macros for Spinlocks and common Trap Code (TODO)\r
+ * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)\r
+ */\r
\r
+/* INCLUDES ******************************************************************/\r
+#include <ndk/asm.h>\r
+.intel_syntax noprefix\r
+\r
+//\r
+// These macros are inlined equivalents of KiAcquire/ReleaseSpinlock, that is,\r
+// they will not be compiled into non-SMP builds. Usage is as follows:\r
+//\r
+// .BeginYourFunction\r
+//      mov reg, lockaddr\r
+//      ACQUIRE_SPINLOCK(reg, .spin)\r
+//      <thread-safe code here>\r
+//      RELEASE_SPINLOCK(reg)\r
+//      <misc code here>\r
+//  retn\r
+//  #IFDEF CONFIG_SMP\r
+//  .spin\r
+//      <any necessary steps to be able to jump back safely>\r
+/       SPIN_ON_LOCK(reg, .BeginYourFunction)\r
+//  #ENDIF\r
+//\r
+#ifdef CONFIG_SMP\r
+#define LOCK lock\r
+#define ACQUIRE_SPINLOCK(x, y) \\r
+    lock bts dword ptr [x], 0; \\r
+    jb y\r
+#define RELEASE_SPINLOCK(x) mov byte ptr [x], 0\r
+#define SPIN_ON_LOCK(x, y) \\r
+1: \\r
+    test dword ptr [x], 1; \\r
+    jz y; \\r
+    pause; \\r
+    jmp 1b\r
+#else\r
+#define LOCK\r
+#define ACQUIRE_SPINLOCK(x, y)\r
+#define RELEASE_SPINLOCK(x) \r
+#endif\r
+\r
+//\r
+// These macros control common execution paths for Traps and System Call Code\r
+// TODO\r
+//\r
+\r