runtime: setup pmp + transfer to user

This commit is contained in:
occheung 2021-10-08 14:34:56 +08:00 committed by Sébastien Bourdeauducq
parent a0bf11b465
commit 27a7a96626
1 changed files with 7 additions and 2 deletions

View File

@ -29,7 +29,7 @@ use core::cell::RefCell;
use core::convert::TryFrom; use core::convert::TryFrom;
use smoltcp::wire::IpCidr; use smoltcp::wire::IpCidr;
use board_misoc::{csr, ident, clock, spiflash, config, net_settings}; use board_misoc::{csr, ident, clock, spiflash, config, net_settings, pmp, boot};
#[cfg(has_ethmac)] #[cfg(has_ethmac)]
use board_misoc::ethmac; use board_misoc::ethmac;
#[cfg(has_drtio)] #[cfg(has_drtio)]
@ -247,10 +247,15 @@ pub extern fn main() -> i32 {
extern { extern {
static mut _fheap: u8; static mut _fheap: u8;
static mut _eheap: u8; static mut _eheap: u8;
static mut _sstack_guard: u8;
} }
ALLOC.add_range(&mut _fheap, &mut _eheap); ALLOC.add_range(&mut _fheap, &mut _eheap);
logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(startup); pmp::init_stack_guard(&_sstack_guard as *const u8 as usize);
logger_artiq::BufferLogger::new(&mut LOG_BUFFER[..]).register(||
boot::start_user(startup as usize)
);
0 0
} }