mini-os: Separating x86 specific spinlock parts
PATCH 1/1 mini-os: Separating x86 specific spinlock parts
Hi Gregor,
for the ia64 port I separated the x86 specific parts of the spinlock stuff and moved these to mini-os/include/x86/arch_spinlock.h
The common parts are now in mini-os/include/spinlock.h
The principle is the same as in my last patch for the mm stuff. Thanks.
Dietmar.
# HG changeset patch
# User [email protected]
# Date 1161255723 -7200
# Node ID 8e645cf5a78377a9eb1fae0bb7a279cdb57b85d3
# Parent deadadadf2ad18ec5ebd1e9e72dc08fcaa973981
I separated the spinlock parts special to the x86 architecture and moved these to include/x86/arch_spinlock.h. The common code is now in include/spinlock.h.
extras/mini-os/include/spinlock.h new file +55 -0
@@ -0,0 +1,55 @@ +#ifndef __ASM_SPINLOCK_H +#define __ASM_SPINLOCK_H + +#include <lib.h> + +/* +* Your basic SMP spinlocks, allowing only a single CPU anywhere +*/ + +typedef struct { +volatile unsigned int slock; +}spinlock_t ; + + +#include "arch_spinlock.h" + + +#define SPINLOCK_MAGIC 0xdead4ead + +#define SPIN_LOCK_UNLOCKED ARCH_SPIN_LOCK_UNLOCKED + +#define spin_lock_init (x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0) + +/* +* Simple spin lock operations. There are two variants, one clears IRQ's +* on the local processor, one does not. +* +* We make no fairness assumptions. They have a cost. +*/ + +#define spin_is_locked (x) arch_spin_is_locked(x) + +#define spin_unlock_wait (x) do { barrier(); } while(spin_is_locked(x)) + + +#define _spin_trylock (lock) ({_raw_spin_trylock(lock) ? \ + 1 : ({ 0;});}) + +#define _spin_lock (lock) \ +do { \ + _raw_spin_lock(lock); \ +} while(0) + +#define _spin_unlock (lock) \ +do { \ + _raw_spin_unlock(lock); \ +} while (0) + + +#define spin_lock (lock) _spin_lock(lock) +#define spin_unlock (lock) _spin_unlock(lock) + +#define DEFINE_SPINLOCK (x) spinlock_t x = SPIN_LOCK_UNLOCKED + +#endif
extras/mini-os/include/x86/arch_spinlock.h new file +93 -0
93 lines not on this page · raw message
extras/mini-os/include/x86/spinlock.h deleted +0 -121
121 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel