2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnlinclude/i386/asmmacro.S
5 * PURPOSE: Assembly Macros for Spinlocks and common Trap Code (TODO)
6 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
9 /* INCLUDES ******************************************************************/
11 .intel_syntax noprefix
14 // These macros are inlined equivalents of KiAcquire/ReleaseSpinlock, that is,
15 // they will not be compiled into non-SMP builds. Usage is as follows:
19 // ACQUIRE_SPINLOCK(reg, .spin)
20 // <thread-safe code here>
21 // RELEASE_SPINLOCK(reg)
26 // <any necessary steps to be able to jump back safely>
27 / SPIN_ON_LOCK(reg, .BeginYourFunction)
32 #define ACQUIRE_SPINLOCK(x, y) \
33 lock bts dword ptr [x], 0; \
35 #define RELEASE_SPINLOCK(x) mov byte ptr [x], 0
36 #define SPIN_ON_LOCK(x, y) \
38 test dword ptr [x], 1; \
44 #define ACQUIRE_SPINLOCK(x, y)
45 #define RELEASE_SPINLOCK(x)
49 // These macros control common execution paths for Traps and System Call Code