LDREX 和 STREX
2013-12-24 19:41
204 查看
LDREX and STREX
Load and Store Register Exclusive.LDREX{[code]cond}
Rt, [
Rn{, #
offset}]
[/code]
STREX{[code]cond}
Rd,
Rt, [
Rn{, #
offset}][/code]
where:
cond
is an optional condition code.
Rd
is the destination register for the returned status.
Rt
is the register to load or store.
Rt2
is the second register for doubleword loads or stores.
Rn
is the register on which the memory address is based.
offset
is an optional offset applied to the value in
Rn.
offsetis
permitted only in 32-bit Thumb instructions. If
offsetis
omitted, an offset of 0 is assumed.
LDREXloads data from memory.
If the physical address has the Shared TLB attribute,
LDREXtags the physical address as exclusive access for the current
processor, and clears any exclusive access tag for this processor for any other physical address.
Otherwise, it tags the fact that the executing processor has an outstanding tagged physical address.
STREXperforms a conditional store to memory. The conditions are as follows:
If the physical address does not have the Shared TLB attribute, and the executing processor has an outstanding tagged physical address, the store takes place, the tag is cleared, and the value 0 is returned in
Rd.
If the physical address does not have the Shared TLB attribute, and the executing processor does not have an outstanding tagged physical address, the store does not take place, and the value 1 is returned in
Rd.
If the physical address has the Shared TLB attribute, and the physical address is tagged as exclusive access for the executing processor, the store takes place, the tag is cleared, and the value 0 is returned in
Rd.
If the physical address has the Shared TLB attribute, and the physical address is not tagged as exclusive access for the executing processor, the store does not take place, and the value 1 is returned in
Rd.
Note
The address used in a STREXinstruction must be the same as the address in the most
recently executed
LDREXinstruction. The result of executing a
STREXinstruction
to a different address is unpredictable.
ARM
LDREXand
STREXare
available in ARMv6 and above.
MOV r1, #0x1 ; load the ‘lock taken’ value try LDREX r0, [LockAddr] ; load the lock value CMP r0, #0 ; is the lock free? STREXEQ r0, r1, [LockAddr] ; try and claim the lock CMPEQ r0, #0 ; did this succeed? BNE try ; no - try again .... ; yes - we have the lock
相关文章推荐
- linux网络配置
- 【android ,11】11.android多线程断点下载
- 编程挑战题目--倒水
- 十二存单法
- 【android,10】10.调用web服务获取手机号码归属地
- c语言的编译过程
- linux命令——iotop
- 网页中插入FLASH(swf文件)的html代码
- sql_mode导致初始化mariadb-10.0.6失败的一个问题
- 字符串的完美度(pongo的编程挑战..)
- jquery使用ajax异步请求、解析json和each函数
- 指针概念;数组指针、字符串指针、结构体指针、动态内存申请、指针数组;
- 新手入门--输入格式三
- 在线教育们想要腾飞 就必须彻底改变产品理念
- Hibernate 缓存
- EXT TREE
- php json数据和数组的转换
- 只有一种英雄主义,就是在认清生活真相之后依然热爱生活
- Apps Listener——FNDSM 和 FNDFS
- 数据库水平切分举例