From 321a8e152244d28236f855eacd0ad00146646797 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Mon, 24 Aug 2020 16:19:59 +0800 Subject: [PATCH] runtime/kernel/core1: reset rtio after interrupted --- src/runtime/src/kernel/core1.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/runtime/src/kernel/core1.rs b/src/runtime/src/kernel/core1.rs index 4b3c001..ec2e27c 100644 --- a/src/runtime/src/kernel/core1.rs +++ b/src/runtime/src/kernel/core1.rs @@ -14,7 +14,7 @@ use libcortex_a9::{ use libboard_zynq::{mpcore, gic}; use libsupport_zynq::ram; use dyld::{self, Library}; -use crate::eh_artiq; +use crate::{eh_artiq, rtio}; use super::{ api::resolve, rpc::rpc_send_async, @@ -137,10 +137,8 @@ impl KernelImage { #[no_mangle] pub fn main_core1() { - debug!("Core1 started"); - enable_fpu(); - debug!("FPU enabled on Core1"); + debug!("Core1 started"); ram::init_alloc_core1(); gic::InterruptController::gic(mpcore::RegisterBlock::mpcore()).enable_interrupts(); @@ -151,6 +149,12 @@ pub fn main_core1() { INIT_LOCK.lock(); core0_tx.reset(); core1_tx.reset(); + if !KERNEL_IMAGE.is_null() { + // indicates forceful termination of previous kernel + KERNEL_IMAGE = core::ptr::null(); + debug!("rtio init"); + rtio::init(); + } dma::init_dma_recorder(); } *CHANNEL_0TO1.lock() = Some(core0_tx);