首先感谢您观看我的问题并回复。
我在banana-pi m1上制作类似软件的操作系统。
这个平台是双皮质a-7。
我还实现了如下的互斥锁。
.global lock_mutex
lock_mutex:
ldr r1, =UNLOCKED
1: ldrex r2, [r0]
cmp r2, r1
wfene @ wfe if locked
read_cp32(r1, MPIDR) @ MPIDR (ARMv7 only)
strexne r2, r1, [r0] @ Trying to lock
cmpne r2, #1 @ if failed to lock acquire
beq 1b @ branch to before 1 label if fail to lock
dmb
bx lr
.global unlock_mutex @ in the case of unlock,
@there's no need to check the status of lock
unlock_mutex:
ldr r1, =UNLOCKED
dmb
str r1, [r0] @ clear the lock
dmb
sev @ sending the event to other processors that is wfe status
bx lr
在" ldrex r2,[r0]"这条指令,什么都没发生,似乎cpu死了。
使用ldrex&之前有任何建议吗? strex指令