Index: kernel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision d7da428424c0f1c2c3f084c6836535553e191008)
+++ kernel/generic/src/synch/spinlock.c	(revision 3c664d678b80ac2e49e94051f441bd812aa3f0d5)
@@ -128,5 +128,5 @@
 void spinlock_unlock_debug(spinlock_t *lock)
 {
-	ASSERT_SPINLOCK(atomic_get(&lock->val) != 0, lock);
+	ASSERT_SPINLOCK(spinlock_locked(lock), lock);
 	
 	/*
@@ -165,4 +165,24 @@
 	
 	return rc;
+}
+
+/** Find out whether the spinlock is currently locked.
+ *
+ * @param lock		Spinlock.
+ * @return		True if the spinlock is locked, false otherwise.
+ */
+bool spinlock_locked(spinlock_t *lock)
+{
+	return atomic_get(&lock->val) != 0;
+}
+
+/** Find out whether the spinlock is currently unlocked.
+ *
+ * @param lock		Spinlock.
+ * @return		True if the spinlock is not locked, false otherwise.
+ */
+bool spinlock_unlocked(spinlock_t *lock)
+{
+	return atomic_get(&lock->val) == 0;
 }
 
@@ -314,4 +334,24 @@
 }
 
+/** Find out whether the IRQ spinlock is currently locked.
+ *
+ * @param lock		IRQ spinlock.
+ * @return		True if the IRQ spinlock is locked, false otherwise.
+ */
+bool irq_spinlock_locked(irq_spinlock_t *ilock)
+{
+	return spinlock_locked(&ilock->lock);
+}
+
+/** Find out whether the IRQ spinlock is currently unlocked.
+ *
+ * @param lock		IRQ spinlock.
+ * @return		True if the IRQ spinlock is not locked, false otherwise.
+ */
+bool irq_spinlock_unlocked(irq_spinlock_t *ilock)
+{
+	return spinlock_unlocked(&ilock->lock);
+}
+
 /** @}
  */
