aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include/x86
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-11-17 09:18:28 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2006-11-17 09:18:28 +0000
commit4fa75a7c3b58f11b028905f6a1d3af3c871b4b7a (patch)
treedc131e6798a5409440ff08fae58e2baa205072c6 /extras/mini-os/include/x86
parent5d3a4a385800111da6ea0b6e607685c0c42a37fa (diff)
downloadxen-4fa75a7c3b58f11b028905f6a1d3af3c871b4b7a.tar.gz
xen-4fa75a7c3b58f11b028905f6a1d3af3c871b4b7a.tar.bz2
xen-4fa75a7c3b58f11b028905f6a1d3af3c871b4b7a.zip
[MINIOS] Refactor spinlock header for multi-arch support.
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. Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
Diffstat (limited to 'extras/mini-os/include/x86')
-rw-r--r--extras/mini-os/include/x86/arch_spinlock.h (renamed from extras/mini-os/include/x86/spinlock.h)38
1 files changed, 5 insertions, 33 deletions
diff --git a/extras/mini-os/include/x86/spinlock.h b/extras/mini-os/include/x86/arch_spinlock.h
index 4274cd2869..a181ed3c92 100644
--- a/extras/mini-os/include/x86/spinlock.h
+++ b/extras/mini-os/include/x86/arch_spinlock.h
@@ -1,21 +1,12 @@
-#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;
+#ifndef __ARCH_ASM_SPINLOCK_H
+#define __ARCH_ASM_SPINLOCK_H
-#define SPINLOCK_MAGIC 0xdead4ead
+#include <lib.h>
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
-#define spin_lock_init(x) do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
+#define ARCH_SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
/*
* Simple spin lock operations. There are two variants, one clears IRQ's
@@ -24,7 +15,7 @@ typedef struct {
* We make no fairness assumptions. They have a cost.
*/
-#define spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) <= 0)
+#define arch_spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) <= 0)
#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x))
#define spin_lock_string \
@@ -99,23 +90,4 @@ static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
:"=m" (lock->slock) : "r" (flags) : "memory");
}
-#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