- Cleanup assembly files and create a header for the macros added and new ones that will be added later for syscall.S & friends. Modified: trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S Modified: trunk/reactos/ntoskrnl/ex/i386/interlck_asm.S Added: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S _____
Modified: trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S --- trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S 2005-12-30 23:56:27 UTC (rev 20475) +++ trunk/reactos/ntoskrnl/ex/i386/fastinterlck_asm.S 2005-12-31 00:03:19 UTC (rev 20476) @@ -8,28 +8,9 @@
/* INCLUDES ******************************************************************/ #include <ndk/asm.h> +#include <internal/i386/asmmacro.S> .intel_syntax noprefix
-//#define CONFIG_SMP - -#ifdef CONFIG_SMP -#define LOCK lock -#define ACQUIRE_SPINLOCK(x, y) \ - lock bts dword ptr [x], 0; \ - jb y -#define RELEASE_SPINLOCK(x) mov byte ptr [x], 0 -#define SPIN_ON_LOCK(x, y) \ -1: \ - test dword ptr [x], 1; \ - jz y; \ - pause; \ - jmp 1b -#else -#define LOCK -#define ACQUIRE_SPINLOCK(x, y) -#define RELEASE_SPINLOCK(x) -#endif - /* FUNCTIONS ****************************************************************/
/* _____
Modified: trunk/reactos/ntoskrnl/ex/i386/interlck_asm.S --- trunk/reactos/ntoskrnl/ex/i386/interlck_asm.S 2005-12-30 23:56:27 UTC (rev 20475) +++ trunk/reactos/ntoskrnl/ex/i386/interlck_asm.S 2005-12-31 00:03:19 UTC (rev 20476) @@ -8,28 +8,9 @@
/* INCLUDES ******************************************************************/ #include <ndk/asm.h> +#include <internal/i386/asmmacro.S> .intel_syntax noprefix
-//#define CONFIG_SMP - -#ifdef CONFIG_SMP -#define LOCK lock -#define ACQUIRE_SPINLOCK(x, y) \ - lock bts dword ptr [x], 0; \ - jb y -#define RELEASE_SPINLOCK(x) mov byte ptr [x], 0 -#define SPIN_ON_LOCK(x, y) \ -1: \ - test dword ptr [x], 1; \ - jz y; \ - pause; \ - jmp 1b -#else -#define LOCK -#define ACQUIRE_SPINLOCK(x, y) -#define RELEASE_SPINLOCK(x) -#endif - /* FUNCTIONS ****************************************************************/
/* _____
Added: trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S --- trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S 2005-12-30 23:56:27 UTC (rev 20475) +++ trunk/reactos/ntoskrnl/include/internal/i386/asmmacro.S 2005-12-31 00:03:19 UTC (rev 20476) @@ -0,0 +1,52 @@
+/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: ntoskrnlinclude/i386/asmmacro.S + * PURPOSE: Assembly Macros for Spinlocks and common Trap Code (TODO) + * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) + */ + +/* INCLUDES ******************************************************************/ +#include <ndk/asm.h> +.intel_syntax noprefix + +// +// These macros are inlined equivalents of KiAcquire/ReleaseSpinlock, that is, +// they will not be compiled into non-SMP builds. Usage is as follows: +// +// .BeginYourFunction +// mov reg, lockaddr +// ACQUIRE_SPINLOCK(reg, .spin) +// <thread-safe code here> +// RELEASE_SPINLOCK(reg) +// <misc code here> +// retn +// #IFDEF CONFIG_SMP +// .spin +// <any necessary steps to be able to jump back safely> +/ SPIN_ON_LOCK(reg, .BeginYourFunction) +// #ENDIF +// +#ifdef CONFIG_SMP +#define LOCK lock +#define ACQUIRE_SPINLOCK(x, y) \ + lock bts dword ptr [x], 0; \ + jb y +#define RELEASE_SPINLOCK(x) mov byte ptr [x], 0 +#define SPIN_ON_LOCK(x, y) \ +1: \ + test dword ptr [x], 1; \ + jz y; \ + pause; \ + jmp 1b +#else +#define LOCK +#define ACQUIRE_SPINLOCK(x, y) +#define RELEASE_SPINLOCK(x) +#endif + +// +// These macros control common execution paths for Traps and System Call Code +// TODO +// +