AN552: Update flash_drv to handle NS access from S

The emulated flash driver started secure transactions to
non-secure accessible addresses from the secure state,
which could cause problems.

Changed the flash driver to use TT instruction to check
the security of the addresses before using them. If the
address can be accessed from NS, then use the NS alias,
else use the S alias.

It's the caller's responsibility to make sure that the
used memory has the same security through the whole range,
as only the starting address' security is checked.

A memory region with S and NS memories in it causes bus
fault, so there is no security vulnerability introduced
by only checking the start address' security.

Change-Id: I2e7982e5062fa590823ad5a594ac9510cbca9056
Signed-off-by: Bence Balogh <bence.balogh@arm.com>
3 files changed