Hi,
i am using SecureHexAIS_OMAP_L138.exe to generate a secure exit .bin file. My main() looks like
rv = SK_registerSCWP(&scw, 1); // returns &scw
scw = SK_allocSC((unsigned)&_stack, (unsigned)&_stack + MY_STACK_SIZE); // returns 0
SK_switchNonSec((void *) (unsigned) &my_main);
I noticed that when I probe the stack pointer with __cursp(), it will be at a correct location (i.e. 0x1182a720) before SK_switchNonSec and at 0xF0680 after (this is in L1D Cache). My program runs in the upper 192kB of L2-Cache, lower 64k are not touched.
1. How can I prevent that?
2. I might force the stack pointer to a valid address in my_main. I do not use a operating system, the program will never return to that point and interrupts are not yet active. Could anything go wrong?
3. In many of the examples (i.e. in sprugq9, "Example 5. setUserKey() Function"), there is code like
stackBottom = (uint32_t) &_stack;
stackEnd = stackBottom + (uint32_t) &_STACK_SIZE;
scw = SK_allocSC(stackBottom, stackEnd);
Why are two adresses added?
Thanks for your help,
Bernhard