forked from M-Labs/artiq
satman/kern: init locked PMP on startup
This commit is contained in:
parent
27a7a96626
commit
0a59c889de
|
@ -23,7 +23,7 @@ use proto_artiq::{kernel_proto, rpc_proto};
|
||||||
use kernel_proto::*;
|
use kernel_proto::*;
|
||||||
#[cfg(has_rtio_dma)]
|
#[cfg(has_rtio_dma)]
|
||||||
use board_misoc::csr;
|
use board_misoc::csr;
|
||||||
use riscv::register::{mcause, mepc};
|
use riscv::register::{mcause, mepc, mtval};
|
||||||
|
|
||||||
fn send(request: &Message) {
|
fn send(request: &Message) {
|
||||||
unsafe { mailbox::send(request as *const _ as usize) }
|
unsafe { mailbox::send(request as *const _ as usize) }
|
||||||
|
@ -493,11 +493,13 @@ pub unsafe fn main() {
|
||||||
let _end = library.lookup(b"_end").unwrap();
|
let _end = library.lookup(b"_end").unwrap();
|
||||||
let __modinit__ = library.lookup(b"__modinit__").unwrap();
|
let __modinit__ = library.lookup(b"__modinit__").unwrap();
|
||||||
let typeinfo = library.lookup(b"typeinfo");
|
let typeinfo = library.lookup(b"typeinfo");
|
||||||
|
let _sstack_guard = library.lookup(b"_sstack_guard").unwrap();
|
||||||
|
|
||||||
LIBRARY = Some(library);
|
LIBRARY = Some(library);
|
||||||
|
|
||||||
ptr::write_bytes(__bss_start as *mut u8, 0, (_end - __bss_start) as usize);
|
ptr::write_bytes(__bss_start as *mut u8, 0, (_end - __bss_start) as usize);
|
||||||
|
|
||||||
|
board_misoc::pmp::init_stack_guard(_sstack_guard as usize);
|
||||||
board_misoc::cache::flush_cpu_dcache();
|
board_misoc::cache::flush_cpu_dcache();
|
||||||
board_misoc::cache::flush_cpu_icache();
|
board_misoc::cache::flush_cpu_icache();
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ extern crate board_artiq;
|
||||||
extern crate riscv;
|
extern crate riscv;
|
||||||
|
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
use board_misoc::{csr, ident, clock, uart_logger, i2c};
|
use board_misoc::{csr, ident, clock, uart_logger, i2c, pmp};
|
||||||
#[cfg(has_si5324)]
|
#[cfg(has_si5324)]
|
||||||
use board_artiq::si5324;
|
use board_artiq::si5324;
|
||||||
#[cfg(has_wrpll)]
|
#[cfg(has_wrpll)]
|
||||||
|
@ -449,6 +449,14 @@ const SI5324_SETTINGS: si5324::FrequencySettings
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn main() -> i32 {
|
pub extern fn main() -> i32 {
|
||||||
|
extern {
|
||||||
|
static mut _sstack_guard: u8;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
pmp::init_stack_guard(&_sstack_guard as *const u8 as usize);
|
||||||
|
}
|
||||||
|
|
||||||
clock::init();
|
clock::init();
|
||||||
uart_logger::ConsoleLogger::register();
|
uart_logger::ConsoleLogger::register();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue