diff --git a/cortex-a-rt/src/lib.rs b/cortex-a-rt/src/lib.rs index c084f1e..304ccbf 100644 --- a/cortex-a-rt/src/lib.rs +++ b/cortex-a-rt/src/lib.rs @@ -708,6 +708,20 @@ core::arch::global_asm!( stm r0!, {{r3}} b 0b 1: + // Zero all registers before calling kmain + mov r0, 0 + mov r1, 0 + mov r2, 0 + mov r3, 0 + mov r4, 0 + mov r5, 0 + mov r6, 0 + mov r7, 0 + mov r8, 0 + mov r9, 0 + mov r10, 0 + mov r11, 0 + mov r12, 0 // Jump to application bl kmain // In case the application returns, loop forever diff --git a/cortex-r-rt/src/lib.rs b/cortex-r-rt/src/lib.rs index b064856..052412f 100644 --- a/cortex-r-rt/src/lib.rs +++ b/cortex-r-rt/src/lib.rs @@ -742,6 +742,20 @@ core::arch::global_asm!( "#, fpu_enable!(), r#" + // Zero all registers before calling kmain + mov r0, 0 + mov r1, 0 + mov r2, 0 + mov r3, 0 + mov r4, 0 + mov r5, 0 + mov r6, 0 + mov r7, 0 + mov r8, 0 + mov r9, 0 + mov r10, 0 + mov r11, 0 + mov r12, 0 // Jump to application bl kmain // In case the application returns, loop forever @@ -805,6 +819,20 @@ core::arch::global_asm!( "#, fpu_enable!(), r#" + // Zero all registers before calling kmain + mov r0, 0 + mov r1, 0 + mov r2, 0 + mov r3, 0 + mov r4, 0 + mov r5, 0 + mov r6, 0 + mov r7, 0 + mov r8, 0 + mov r9, 0 + mov r10, 0 + mov r11, 0 + mov r12, 0 // Jump to application bl kmain // In case the application returns, loop forever diff --git a/examples/mps3-an536/src/bin/smp_test.rs b/examples/mps3-an536/src/bin/smp_test.rs index c7f8a76..6155787 100644 --- a/examples/mps3-an536/src/bin/smp_test.rs +++ b/examples/mps3-an536/src/bin/smp_test.rs @@ -209,6 +209,21 @@ core::arch::global_asm!( ldr r0, [r0] // set up our stacks using that stack pointer bl _stack_setup + // Zero all registers before calling kmain + mov r0, 0 + mov r1, 0 + mov r2, 0 + mov r3, 0 + mov r4, 0 + mov r5, 0 + mov r6, 0 + mov r7, 0 + mov r8, 0 + mov r9, 0 + mov r10, 0 + mov r11, 0 + mov r12, 0 + // call our kmain2 for core 1 bl kmain2 .size _start, . - _start "#,