首页
社区
课程
招聘
[旧帖] [求助] lock cmpxchg [edx], ecx 做的什么操作? 0.00雪花
发表于: 2009-4-29 14:34 6512

[旧帖] [求助] lock cmpxchg [edx], ecx 做的什么操作? 0.00雪花

2009-4-29 14:34
6512
请教:lock cmpxchg [edx], ecx 这句做的什么操作

在高级语言中又相当于什么?

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (1)
雪    币: 331
活跃值: (57)
能力值: ( LV7,RANK:100 )
在线值:
发帖
回帖
粉丝
2
CMPXCHG - Compare and Exchange
0F B0/ r                 CMPXCHG r/m8,r8                 Compare AL with r/m8. If equal, ZF is set and r8 is loaded
                                        into r/m8. Else, clear ZF and load r/m8 into AL.
0F B1/ r                 CMPXCHG r/m16,r16         Compare AX with r/m16. If equal, ZF is set and r16 is
                                        loaded into r/m16. Else, clear ZF and load r/m16 into AL
0F B1/ r                 CMPXCHG r/m32,r32         Compare EAX with r/m32. If equal, ZF is set and r32 is
                                        loaded into r/m32. Else, clear ZF and load r/m32 into AL

Description
Compares the value in the AL, AX, or EAX register (depending on the size of the operand) with the first operand (destination operand). If the two values are equal, the second operand (source operand) is loaded into the destination operand. Otherwise, the destination operand is loaded into the AL, AX, or EAX register.

This instruction can be used with a LOCK prefix to allow the instruction to be executed atomi-cally. To simplify the interface to the processor's bus, the destination operand receives a write cycle without regard to the result of the comparison. The destination operand is written back if the comparison fails; otherwise, the source operand is written into the destination. (The processor never produces a locked read without also producing a locked write.)

没有对应高级语言
2009-4-29 15:52
0
游客
登录 | 注册 方可回帖
返回
//