05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

B2.4.7 Exclusive monitors operations<br />

Common Memory System <strong>Architecture</strong> Features<br />

The SetExclusiveMonitors() function sets the exclusive monitors for a Load-Exclusive instruction. The<br />

ExclusiveMonitorsPass() function checks whether a Store-Exclusive instruction still has possession of the<br />

exclusive monitors <strong>and</strong> therefore completes successfully.<br />

// SetExclusiveMonitors()<br />

// ======================<br />

SetExclusiveMonitors(bits(32) address, integer size)<br />

memaddrdesc = TranslateAddress(address, CurrentModeIsPrivileged(), FALSE);<br />

if memaddrdesc.memattrs.shareable then<br />

MarkExclusiveGlobal(memaddrdesc.physicaladdress, ProcessorID(), size);<br />

MarkExclusiveLocal(memaddrdesc.physicaladdress, ProcessorID(), size);<br />

// ExclusiveMonitorsPass()<br />

// =======================<br />

boolean ExclusiveMonitorsPass(bits(32) address, integer size)<br />

// It is IMPLEMENTATION DEFINED whether the detection of memory aborts happens<br />

// before or after the check on the local Exclusive Monitor. As a result a failure<br />

// of the local monitor can occur on some implementations even if the memory<br />

// access would give an memory abort.<br />

if address != Align(address, size) then<br />

AlignmentFault(address, TRUE);<br />

else<br />

memaddrdesc = TranslateAddress(address, CurrentModeIsPrivileged(), TRUE);<br />

passed = IsExclusiveLocal(memaddrdesc.paddress, ProcessorID(), size);<br />

if memaddrdesc.memattrs.shareable then<br />

passed = passed && IsExclusiveGlobal(memaddrdesc.paddress, ProcessorID(), size);<br />

if passed then<br />

ClearExclusiveLocal(ProcessorID());<br />

return passed;<br />

The MarkExclusiveGlobal() procedure takes as arguments a FullAddress paddress, the processor identifier<br />

processorid <strong>and</strong> the size of the transfer. The procedure records that processor processorid has requested<br />

exclusive access covering at least size bytes from address paddress. The size of region marked as exclusive<br />

is IMPLEMENTATION DEFINED, up to a limit of 2KB, <strong>and</strong> no smaller than two words, <strong>and</strong> aligned in the<br />

address space to the size of the region. It is UNPREDICTABLE whether this causes any previous request for<br />

exclusive access to any other address by the same processor to be cleared.<br />

MarkExclusiveGlobal(FullAddress paddress, integer processorid, integer size)<br />

<strong>ARM</strong> DDI 0406B Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. B2-35

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

Saved successfully!

Ooh no, something went wrong!