Hi,

The smc_handle() in monitor.S, it does nothing but "movs pc, lr".
Does it set the NS bit to 1 in SCR?

Also, what did you do to ensure that 0x11000000 is not used by the kernel?

Could you share the code (if possible) so that I could better understand the problem. 

Regards,
Yanyan



From: Devel <devel-bounces@sel4.systems> on behalf of ¼½¶«Ðñ <jidongxu1993@gmail.com>
Sent: Tuesday, August 28, 2018 1:02 PM
To: devel@sel4.systems
Subject: [seL4] SMC in seL4
 
Hello,
I'm porting sel4 to imx6q sabrelite as the trusted OS in trustzone.  I initialize the monitor mode by setting the sp to  STACK_TOP and copying arm_monitor_vector to MON_VECTOR_START according to the functions "install_monitor_hook()" and "switch_to_mon_mode()" in "platform_init.c".
#define VECTOR_BASE     0x11000000(addr is not used by the seL4 kernel)
#define STACK_TOP       (VECTOR_BASE + (1 << 12) - 0x10)
#define MON_VECTOR_START    0x11000000(The VECTOR_BASE is the same as MON_VECTOR_START)
The smc_handle() in monitor.S, it does nothing but "movs pc, lr".  After calling smc in SVC mode, it hangs without any log.  If I comment the "smc #0", it can return the caller successfully in usr mode.
    stmfd    sp!, {r3-r11, lr}
    dsb
    smc #0
    ldmfd    sp!, {r3-r11, pc}
Is the sp in monitor mode appropriate? Or I need to do something else in initialization operations?  What's wrong with it?  Do you have any ideas?
Thank you!
Dongxu Ji