09.12.2012 Views

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

Cortex-A8 Technical Reference Manual - ARM Information Center

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.

2.16 Software consideration for Security Extensions<br />

Programmers Model<br />

The Monitor mode is responsible for the switch from one state to the other. You must only<br />

modify the SCR in Monitor mode.<br />

The recommended way to return to the Nonsecure state is to:<br />

• set the NS bit to 1 in the SCR<br />

• execute a MOVS or SUBS.<br />

All <strong>ARM</strong> implementations ensure that the processor cannot execute the prefetched instructions<br />

that follow MOVS, SUBS, or equivalents, with secure access permissions.<br />

It is strongly recommended that you do not use an MSR instruction to switch from the Secure to<br />

the Nonsecure state. There is no guarantee enforced in the architecture that, after the NS bit is<br />

set to 1 in Monitor mode, an MSR instruction avoids execution of prefetched instructions with<br />

secure access permission. This is because the processor prefetches the instructions that follow<br />

the MSR with secure privileged permissions. This might form a security hole in the system if the<br />

prefetched instructions then execute in the Nonsecure state.<br />

If the prefetched instructions are in nonsecure memory, with the MSR at the boundary between<br />

secure and nonsecure memory, they might be corrupted when giving secure information to the<br />

Nonsecure state.<br />

To avoid this problem with the MSR instruction, you can use an IMB sequence shortly after the MSR.<br />

If you use the IMB sequence you must ensure that the instructions executed after the MSR and<br />

before the IMB do not leak any information to the Nonsecure state and do not rely on the secure<br />

permission level.<br />

It is strongly recommended that you do not set the NS bit to 1 in privileged modes other than in<br />

Monitor mode. If you do so, you face the same problem as a return to the Nonsecure state with<br />

the MSR instruction. To avoid leakage after an MSR instruction, use an IMB sequence.<br />

To enter the Secure Monitor, the processor executes the following instruction:<br />

SMC {} <br />

where:<br />

Is the condition that the processor executes the SMC.<br />

The processor ignores this 4-bit immediate value, but the Secure Monitor can use<br />

it to determine the service to provide.<br />

To return from the Secure Monitor, the processor executes the following instruction:<br />

MOVS PC, R14_mon<br />

<strong>ARM</strong> DDI 0344K Copyright © 2006-2010 <strong>ARM</strong> Limited. All rights reserved. 2-34<br />

ID060510 Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!