23.10.2014 Views

RealView - ARM Information Center

RealView - ARM Information Center

RealView - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ARM</strong> 指 令 参 考<br />

示 例<br />

try<br />

MOV r1, #0x1<br />

; load the ‘lock taken’ value<br />

LDREX r0, [LockAddr] ; load the lock value<br />

CMP r0, #0<br />

; is the lock free?<br />

STREXEQ r0, r1, [LockAddr] ; try and claim the lock<br />

CMPEQ r0, #0<br />

; did this succeed?<br />

BNE try<br />

; no – try again<br />

.... ; yes – we have the lock<br />

不 正 确 的 示 例<br />

LDREX r0, [r2,#96]! ; no offset allowed<br />

STREX r11, r10, [r15] ; use of r15 not allowed<br />

LDREXGT r6, r4, [r10] ; LDREX has only two registers in its syntax<br />

STREX r3, r3, [r7] ; Rd must be distinct from Rn (and from Rm)<br />

4-30 © 2002、 2003 <strong>ARM</strong> Limited 版 权 所 有 。 保 留 所 有 权 利 。 <strong>ARM</strong> DUI 0204BSC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!