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.

The System Level Programmers’ Model<br />

Note<br />

To avoid security holes, <strong>ARM</strong> strongly recommends that:<br />

you do not change from Secure to Non-secure state by using an MSR or CPS instruction to switch from<br />

Monitor mode to some other mode while SCR.NS is 1<br />

you do not use an MCR instruction that writes SCR.NS to change from Secure to Non-secure state. This<br />

means you should not alter the SCR.NS bit in any mode except Monitor mode.<br />

The usual mechanism for changing from Secure to Non-secure state is an exception return.<br />

Pseudocode details of Secure state operations<br />

The HaveSecurityExt() function returns TRUE if the Security Extensions are implemented, <strong>and</strong> FALSE<br />

otherwise.<br />

The following function returns TRUE if the Security Extensions are not implemented or the processor is in<br />

Secure state, <strong>and</strong> FALSE otherwise.<br />

// IsSecure()<br />

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

boolean IsSecure()<br />

return !HaveSecurityExt() || SCR.NS == ‘0’ || CPSR.M == ‘10110’; // Monitor mode<br />

B1.5.2 Impact of the Security Extensions on the modes <strong>and</strong> exception model<br />

This section summarizes the effect of the Security Extensions on the modes <strong>and</strong> exception model, to give a<br />

overview of the Security Extensions. When the Security Extensions are implemented:<br />

An additional mode, Monitor mode, is implemented. For more information, see <strong>ARM</strong> processor<br />

modes on page B1-6 <strong>and</strong> Security states on page B1-25.<br />

An additional exception, the Secure Monitor Call (SMC) exception, is implemented. This is<br />

generated by the SMC instruction. For more information, see Secure Monitor Call (SMC) exception on<br />

page B1-53 <strong>and</strong> SMC (previously SMI) on page B6-18.<br />

Because the SCTLR is banked between the Secure <strong>and</strong> Non-secure states, the V <strong>and</strong> VE bits are<br />

defined independently for the Secure <strong>and</strong> Non-secure states. For each state:<br />

— the SCTLR.V bit controls whether the normal or the high exception vectors are used<br />

— the SCTLR.VE bit controls whether the IRQ <strong>and</strong> FIQ vectors are IMPLEMENTATION DEFINED.<br />

For more information, see Exception vectors <strong>and</strong> the exception base address on page B1-30.<br />

The base address for the normal exception vectors is held in a CP15 register that is banked between<br />

the two security states. This register defines the base address used for exceptions h<strong>and</strong>led in modes<br />

other than Monitor mode. Another CP15 register holds the base address for exceptions h<strong>and</strong>led in<br />

Monitor mode. For more information, see Exception vectors <strong>and</strong> the exception base address on<br />

page B1-30.<br />

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

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

Saved successfully!

Ooh no, something went wrong!