summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/lock.s
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2025-08-10 15:40:19 -0400
committerJon Santmyer <jon@jonsantmyer.com>2025-08-10 15:40:19 -0400
commitc4f8ef91f18d854a4ede7a94e95b2eab898d6963 (patch)
treec2772c4f380a684b6fa347f03b13f9476bf9500c /arch/x86_64/lock.s
parentb905869a35f062a4e5072f10bec3a2ba3db0e365 (diff)
downloadjove-kernel-c4f8ef91f18d854a4ede7a94e95b2eab898d6963.tar.gz
jove-kernel-c4f8ef91f18d854a4ede7a94e95b2eab898d6963.tar.bz2
jove-kernel-c4f8ef91f18d854a4ede7a94e95b2eab898d6963.zip
working usermode objdir iteration
Diffstat (limited to 'arch/x86_64/lock.s')
-rw-r--r--arch/x86_64/lock.s19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86_64/lock.s b/arch/x86_64/lock.s
new file mode 100644
index 0000000..b63f078
--- /dev/null
+++ b/arch/x86_64/lock.s
@@ -0,0 +1,19 @@
+.global _mtx_acquire
+.type _mtx_acquire @function
+_mtx_acquire:
+ lock btsw $0, (%rdi)
+ jc .spin
+ ret
+.spin:
+ pause
+ testb $1, (%rdi)
+ jnz .spin
+ jmp _mtx_acquire
+.size _mtx_acquire, . - _mtx_acquire
+
+.global _mtx_release
+.type _mtx_release @function
+_mtx_release:
+ movb $0, (%rdi)
+ ret
+.size _mtx_release, . - _mtx_release