Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition to insecure mode fails #1

Open
andrewstevens-infineon opened this issue Feb 10, 2022 · 2 comments
Open

Transition to insecure mode fails #1

andrewstevens-infineon opened this issue Feb 10, 2022 · 2 comments

Comments

@andrewstevens-infineon
Copy link

The secure-mode start-up works fine but the call into nonsecure_init fails suggesting some part of the setup of the non-secure execution context is buggy...

Address: 0x2007c1
|mpu_region: 0
|sau_region: 0
|mpu_region_valid: 0
|sau_region_valid: 1
|read_ok: 1
|readwrite_ok: 1
|nonsecure_read_ok: 1
|nonsecure_readwrite_ok: 1
|secure: 0
|idau_region_valid: 1
|idau_region: 0

Taking exception 3 [Prefetch Abort]
...really SecureFault with SFSR.INVEP
...taking pending secure exception 3

@imcchaves
Copy link

Actually what fails is the SG instruction when NS tries to call S side. So probably something with SAU/IDAU configuration.

(gdb) x/4i 0x100019e0
0x100019e0 <sec_sum>: sg
0x100019e4 <sec_sum+4>: b.w 0x10000a00 <sec_sum>
0x100019e8: movs r0, r0
0x100019ea: movs r0, r0

And from the ARM documentation:
SFSR.INVEP:
Invalid entry point. This bit is set if a function call from the Non-secure state or exception targets a non-SG instruction in the Secure state. This bit is also set if the target address is an SG instruction, but there is no matching SAU/IDAU region with the NSC flag set.

@imcchaves
Copy link

imcchaves commented Nov 15, 2024

The problem is that the SAU region 2 has wrong addresses. It nees to be adjusted to the veneers function.
After this change the code works properly.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants