aboutsummaryrefslogtreecommitdiff
path: root/kernel/util/lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/util/lock.c')
-rw-r--r--kernel/util/lock.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/util/lock.c b/kernel/util/lock.c
new file mode 100644
index 0000000..c9fe654
--- /dev/null
+++ b/kernel/util/lock.c
@@ -0,0 +1,20 @@
+#include <cpu.h>
+#include <cpu/atomic/swap.h>
+#include <util/mutex.h>
+#include <util/lock.h>
+
+void lock(struct Lock* l)
+{
+ unsigned long mode = getmode() & 0x1F;
+ if (mode == 0x10) {
+ sys1(SYS_LOCK, l);
+ }
+}
+
+void unlock(struct Lock* l)
+{
+ unsigned long mode = getmode() & 0x1F;
+ if (mode == 0x10) {
+ sys1(SYS_UNLOCK, l);
+ }
+}