summaryrefslogtreecommitdiff
path: root/demo/atomic.S
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-10-06 07:37:16 -0600
committerAlejandro Soto <alejandro@34project.org>2023-10-06 07:37:16 -0600
commit39fd8b8428da1e4bb0a182e1bcc61ec2d54563a4 (patch)
treea4dedd73b8fbfdfbfd1c2ca8c1a4c4a983fd9e26 /demo/atomic.S
parentfac14c8c03592f101d34116cb8ecde908e92c18b (diff)
demo: implement remote cmds
Diffstat (limited to '')
-rw-r--r--demo/atomic.S (renamed from demo/lock.S)20
1 files changed, 20 insertions, 0 deletions
diff --git a/demo/lock.S b/demo/atomic.S
index 51805f2..991ad5a 100644
--- a/demo/lock.S
+++ b/demo/atomic.S
@@ -28,3 +28,23 @@ spin_unlock:
str r2, [r0]
msr cpsr_c, r1
mov pc, lr
+
+.global compare_exchange_64
+compare_exchange_64:
+ push {r4, r5, r6, r7, r8}
+ ldr r4, [r1]
+ ldr r5, [r1, #4]
+ add r8, r0, #4
+ ldrex r6, [r0]
+ ldrex r7, [r8]
+ teq r4, r6
+ teqeq r5, r7
+ strexeq r4, r2, [r0]
+ strexeq r4, r3, [r8]
+ teqeq r4, #0
+ moveq r0, #1
+ movne r0, #0
+ strne r6, [r1]
+ strne r7, [r1, #4]
+ pop {r4, r5, r6, r7, r8}
+ mov pc, lr