mirror of
https://github.com/reactos/reactos.git
synced 2024-07-13 16:15:05 +00:00
- Cleanup assembly files and create a header for the macros added and new ones that will be added later for syscall.S & friends.
svn path=/trunk/; revision=20476
This commit is contained in:
parent
3362b78138
commit
e1a79c8b7f
|
@ -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 ****************************************************************/
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 ****************************************************************/
|
||||
|
||||
/*
|
||||
|
|
52
reactos/ntoskrnl/include/internal/i386/asmmacro.S
Normal file
52
reactos/ntoskrnl/include/internal/i386/asmmacro.S
Normal file
|
@ -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
|
||||
//
|
||||
|
Loading…
Reference in a new issue