mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
bump loader version number
This commit is contained in:
parent
8d501cfcc6
commit
337afbbe47
2 changed files with 27 additions and 19 deletions
|
|
@ -2,9 +2,10 @@ use crate::println;
|
||||||
|
|
||||||
pub const SIGBLOCK_SIZE: usize = 0x1000;
|
pub const SIGBLOCK_SIZE: usize = 0x1000;
|
||||||
|
|
||||||
const VERSION_STR: &'static str = "Xous OS Loader v0.9.1\n\r";
|
const VERSION_STR: &'static str = "Xous OS Loader v0.9.2\n\r";
|
||||||
// v0.9.0 -- initial version
|
// v0.9.0 -- initial version
|
||||||
// v0.9.1 -- booting with hw acceleration, and "simplest signature" check on the entire xous.img blob
|
// v0.9.1 -- booting with hw acceleration, and "simplest signature" check on the entire xous.img blob
|
||||||
|
// v0.9.2 -- add version and length check between header and signed area
|
||||||
|
|
||||||
pub const STACK_LEN: u32 = 8192 - (7 * 4); // 7 words for backup kernel args
|
pub const STACK_LEN: u32 = 8192 - (7 * 4); // 7 words for backup kernel args
|
||||||
pub const STACK_TOP: u32 = 0x4100_0000 - STACK_LEN;
|
pub const STACK_TOP: u32 = 0x4100_0000 - STACK_LEN;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use xous_ipc::Buffer;
|
||||||
|
|
||||||
use num_traits::*;
|
use num_traits::*;
|
||||||
use std::io::{Result, Error, ErrorKind};
|
use std::io::{Result, Error, ErrorKind};
|
||||||
use std::path::Path;
|
use std::path::{Path, Component};
|
||||||
use std::format;
|
use std::format;
|
||||||
|
|
||||||
pub const PDDB_MAX_DICT_NAME_LEN: usize = 64;
|
pub const PDDB_MAX_DICT_NAME_LEN: usize = 64;
|
||||||
|
|
@ -28,32 +28,39 @@ impl PddbKey {
|
||||||
REFCOUNT.store(REFCOUNT.load(Ordering::Relaxed) + 1, Ordering::Relaxed);
|
REFCOUNT.store(REFCOUNT.load(Ordering::Relaxed) + 1, Ordering::Relaxed);
|
||||||
let conn = xns.request_connection_blocking(api::SERVER_NAME_PDDB).expect("Can't connect to Pddb server");
|
let conn = xns.request_connection_blocking(api::SERVER_NAME_PDDB).expect("Can't connect to Pddb server");
|
||||||
|
|
||||||
if !path.is_absolute() {
|
if !path.as_ref().is_absolute() {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "All Xous keys must be fully specified relative to a dictionary"));
|
return Err(Error::new(ErrorKind::InvalidInput, "All PDDB keys must be fully specified relative to a dictionary"));
|
||||||
}
|
}
|
||||||
let mut dict = String::new();
|
let mut dict = String::new();
|
||||||
let mut key = String::new();
|
let mut key = String::new();
|
||||||
if let Some(pathstr) = path.to_str() {
|
let mut components = path.as_ref().components();
|
||||||
if let Some(path_lstrip) = path.strip_prefix("/") {
|
match components.next().unwrap() {
|
||||||
if let Some((dictstr, keystr)) = path_lstrip.split_once("/") {
|
Component::Prefix(prefix_component) => {
|
||||||
if dictstr.len() < PDDB_MAX_DICT_NAME_LEN {
|
if let Some(dictstr) = prefix_component.as_os_str().to_str() {
|
||||||
|
if dictstr.len() <= PDDB_MAX_DICT_NAME_LEN {
|
||||||
dict.push_str(dictstr);
|
dict.push_str(dictstr);
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, format!("Xous dictionary names must be shorter than {} bytes", PDDB_MAX_DICT_NAME_LEN)));
|
return Err(Error::new(ErrorKind::InvalidInput, format!("PDDB dictionary names must be shorter than {} bytes", PDDB_MAX_DICT_NAME_LEN)));
|
||||||
}
|
|
||||||
if keystr.len() < PDDB_MAX_KEY_NAME_LEN {
|
|
||||||
key.push_str(keystr);
|
|
||||||
} else {
|
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, format!("Xous key names must be shorter than {} bytes", PDDB_MAX_DICT_NAME_LEN)));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "All Xous keys must be of the format /dict/key; the key may contain more /'s"));
|
return Err(Error::new(ErrorKind::InvalidInput, "PDDB dictionary names must valid UTF-8"));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "All Xous keys must be absolute and start with a /"));
|
|
||||||
}
|
}
|
||||||
} else {
|
_ => {
|
||||||
return Err(Error::new(ErrorKind::InvalidInput, "All Xous keys must be valid UTF-8"));
|
return Err(Error::new(ErrorKind::InvalidInput, "All PDDB entries must be of the format `dict:key`, where `dict` is treated as a Prefix"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// collect the remaining components into the key
|
||||||
|
for comps in components {
|
||||||
|
if let Some(keystr) = comps.as_os_str().to_str() {
|
||||||
|
key.push_str(keystr);
|
||||||
|
} else {
|
||||||
|
return Err(Error::new(ErrorKind::InvalidInput, "PDDB dictionary names must valid UTF-8"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if key.len() > PDDB_MAX_KEY_NAME_LEN {
|
||||||
|
return Err(Error::new(ErrorKind::InvalidInput, format!("PDDB key names must be shorter than {} bytes", PDDB_MAX_DICT_NAME_LEN)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let request = PddbKeyRequest {
|
let request = PddbKeyRequest {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue