summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1995-08-02 16:31:46 +0000
committerMichael I. Bushnell <mib@gnu.org>1995-08-02 16:31:46 +0000
commit214dd7cfdb452f912941feb32e946089b5db80a1 (patch)
tree69ce4b8598540c9d1d7f97ace472e5c4396efa09
parent4426dae8df2502bffa143088173b5e7102456c8b (diff)
Formerly system.h.~2~
-rw-r--r--pfinet/asm/system.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/pfinet/asm/system.h b/pfinet/asm/system.h
index e69de29b..a631c91e 100644
--- a/pfinet/asm/system.h
+++ b/pfinet/asm/system.h
@@ -0,0 +1,48 @@
+#include <cthreads.h>
+
+/* This lock is held when "interrupts" are disabled. */
+extern struct mutex global_interrupt_lock;
+
+/* Save the "processor state" in the longword FLAGS. */
+/* We define 1 to mean that global_interrupt_lock is held. */
+
+#define save_flags(x) _real_save_flags (&x)
+extern inline void
+_real_save_flags (u_long *flagsword)
+{
+ int locked;
+
+ locked = !mutex_try_lock (&global_interrupt_lock);
+ if (!locked)
+ mutex_unlock (&global_interrupt_lock);
+ *flagsword = locked;
+}
+
+/* Restore state saved in FLAGS. */
+extern inline void
+restore_flags (u_long flags)
+{
+ if (flags)
+ mutex_try_lock (&global_interrupt_lock);
+ else
+ mutex_unlock (&global_interrupt_lock);
+}
+
+/* Prevent "interrupts" from happening. */
+extern inline void
+cli ()
+{
+ mutex_try_lock (&global_interrupt_lock);
+}
+
+/* Permit "interrupts". */
+extern inline void
+sti ()
+{
+ mutex_unlock (&global_interrupt_lock);
+}
+
+
+
+
+