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.

when MemArch_PMSA AlignmentFaultP(address, iswrite);<br />

// TranslateAddress()<br />

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

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

AddressDescriptor TranslateAddress(bits(32) VA, boolean ispriv, boolean iswrite)<br />

case MemorySystem<strong>Architecture</strong>() of<br />

when MemArch_VMSA return TranslateAddressV(VA, ispriv, iswrite);<br />

when MemArch_PMSA return TranslateAddressP(VA, ispriv, iswrite);<br />

B2.4.4 Aligned memory accesses<br />

The MemA[] function performs a memory access at the current privilege level, <strong>and</strong> the MemA_unpriv[] function<br />

performs an access that is always unprivileged. In both cases the architecture requires the access to be<br />

aligned, <strong>and</strong> in <strong>ARM</strong>v7 the function generates an Alignment fault if it is not.<br />

Note<br />

In versions of the architecture before <strong>ARM</strong>v7, if the SCTLR.A <strong>and</strong> SCTLR.U bits are both 0, an unaligned<br />

access is forced to be aligned by replacing the low-order address bits with zeros.<br />

// MemA[]<br />

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

bits(8*size) MemA[bits(32) address, integer size]<br />

return MemA_with_priv[address, size, CurrentModeIsPrivileged()];<br />

MemA[bits(32) address, integer size] = bits(8*size) value<br />

MemA_with_priv[address, size, CurrentModeIsPrivileged()] = value;<br />

return;<br />

// MemA_unpriv[]<br />

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

bits(8*size) MemA_unpriv[bits(32) address, integer size]<br />

return MemA_with_priv[address, size, FALSE];<br />

MemA_unpriv[bits(32) address, integer size] = bits(8*size) value<br />

MemA_with_priv[address, size, FALSE] = value;<br />

return;<br />

// MemA_with_priv[]<br />

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

// Non-assignment form<br />

bits(8*size) MemA_with_priv[bits(32) address, integer size, boolean privileged]<br />

// Sort out alignment<br />

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

VA = address;<br />

elsif SCTLR.A == ‘1’ || SCTLR.U == ‘1’ then<br />

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

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

Saved successfully!

Ooh no, something went wrong!