mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add feature gate on v2p per xobs' request
This commit is contained in:
parent
6d9848c239
commit
ea37ce2ea1
5 changed files with 34 additions and 18 deletions
|
|
@ -35,6 +35,7 @@ gdbserver = ["gdbstub", "gdbstub_arch"]
|
||||||
print-panics = []
|
print-panics = []
|
||||||
report-memory = ["stats_alloc"]
|
report-memory = ["stats_alloc"]
|
||||||
wrap-print = []
|
wrap-print = []
|
||||||
|
v2p = []
|
||||||
# default = ["print-panics", "debug-print", "wrap-print"]
|
# default = ["print-panics", "debug-print", "wrap-print"]
|
||||||
default = ["print-panics", "gdbserver"]
|
default = ["print-panics", "gdbserver"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -936,6 +936,7 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
|
||||||
}),
|
}),
|
||||||
_ => Err(xous_kernel::Error::InvalidLimit),
|
_ => Err(xous_kernel::Error::InvalidLimit),
|
||||||
},
|
},
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
SysCall::VirtToPhys(vaddr) => {
|
SysCall::VirtToPhys(vaddr) => {
|
||||||
let phys_addr = crate::arch::mem::virt_to_phys(vaddr as usize);
|
let phys_addr = crate::arch::mem::virt_to_phys(vaddr as usize);
|
||||||
match phys_addr {
|
match phys_addr {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ core = { version = '1.0.0', optional = true, package = 'rustc-std-workspace-core
|
||||||
compiler_builtins = { version = '0.1.0', optional = true }
|
compiler_builtins = { version = '0.1.0', optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
v2p = []
|
||||||
|
default = []
|
||||||
|
|
||||||
# If this is set, then the "Drop" feature of MemoryMessage structs
|
# If this is set, then the "Drop" feature of MemoryMessage structs
|
||||||
# will not be implemented. This should only be set by the kernel.
|
# will not be implemented. This should only be set by the kernel.
|
||||||
|
|
|
||||||
|
|
@ -467,6 +467,7 @@ pub enum SysCall {
|
||||||
///
|
///
|
||||||
/// ## Errors
|
/// ## Errors
|
||||||
/// * **BadAddress**: The mapping does not exist
|
/// * **BadAddress**: The mapping does not exist
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
VirtToPhys(
|
VirtToPhys(
|
||||||
usize, /* virtual address */
|
usize, /* virtual address */
|
||||||
),
|
),
|
||||||
|
|
@ -515,6 +516,7 @@ pub enum SysCallNumber {
|
||||||
JoinThread = 36,
|
JoinThread = 36,
|
||||||
SetExceptionHandler = 37,
|
SetExceptionHandler = 37,
|
||||||
AdjustProcessLimit = 38,
|
AdjustProcessLimit = 38,
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
VirtToPhys = 39,
|
VirtToPhys = 39,
|
||||||
Invalid,
|
Invalid,
|
||||||
}
|
}
|
||||||
|
|
@ -560,6 +562,7 @@ impl SysCallNumber {
|
||||||
36 => JoinThread,
|
36 => JoinThread,
|
||||||
37 => SetExceptionHandler,
|
37 => SetExceptionHandler,
|
||||||
38 => AdjustProcessLimit,
|
38 => AdjustProcessLimit,
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
39 => VirtToPhys,
|
39 => VirtToPhys,
|
||||||
_ => Invalid,
|
_ => Invalid,
|
||||||
}
|
}
|
||||||
|
|
@ -925,6 +928,7 @@ impl SysCall {
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
SysCall::VirtToPhys(vaddr) => [
|
SysCall::VirtToPhys(vaddr) => [
|
||||||
SysCallNumber::VirtToPhys as usize,
|
SysCallNumber::VirtToPhys as usize,
|
||||||
*vaddr,
|
*vaddr,
|
||||||
|
|
@ -1099,6 +1103,7 @@ impl SysCall {
|
||||||
SysCallNumber::JoinThread => SysCall::JoinThread(a1 as _),
|
SysCallNumber::JoinThread => SysCall::JoinThread(a1 as _),
|
||||||
SysCallNumber::SetExceptionHandler => SysCall::SetExceptionHandler(a1 as _, a2 as _),
|
SysCallNumber::SetExceptionHandler => SysCall::SetExceptionHandler(a1 as _, a2 as _),
|
||||||
SysCallNumber::AdjustProcessLimit => SysCall::AdjustProcessLimit(a1, a2, a3),
|
SysCallNumber::AdjustProcessLimit => SysCall::AdjustProcessLimit(a1, a2, a3),
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
SysCallNumber::VirtToPhys => SysCall::VirtToPhys(a1 as _),
|
SysCallNumber::VirtToPhys => SysCall::VirtToPhys(a1 as _),
|
||||||
SysCallNumber::Invalid => SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7),
|
SysCallNumber::Invalid => SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7),
|
||||||
})
|
})
|
||||||
|
|
@ -1867,6 +1872,7 @@ pub fn set_exception_handler(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// Translate a virtual address to a physical address
|
/// Translate a virtual address to a physical address
|
||||||
|
#[cfg(feature="v2p")]
|
||||||
pub fn virt_to_phys(va: usize) -> core::result::Result<usize, Error> {
|
pub fn virt_to_phys(va: usize) -> core::result::Result<usize, Error> {
|
||||||
rsyscall(SysCall::VirtToPhys(va)).and_then(|result| {
|
rsyscall(SysCall::VirtToPhys(va)).and_then(|result| {
|
||||||
if let Result::Scalar1(pa) = result {
|
if let Result::Scalar1(pa) = result {
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
None,
|
None,
|
||||||
Some(&["--features", "tts", "--features", "braille"]),
|
Some(&["--features", "tts", "--features", "braille"]),
|
||||||
&[&tts_exec_string],
|
&[&tts_exec_string],
|
||||||
None,
|
None, None,
|
||||||
)?;
|
)?;
|
||||||
let mut locale_revert = OpenOptions::new()
|
let mut locale_revert = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
|
|
@ -345,7 +345,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
extra_packages.as_slice(), None)?;
|
extra_packages.as_slice(), None, None)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some("libstd-test") => {
|
Some("libstd-test") => {
|
||||||
|
|
@ -385,6 +385,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
Some(&["--features", "renode-bypass"]),
|
Some(&["--features", "renode-bypass"]),
|
||||||
|
None,
|
||||||
)?
|
)?
|
||||||
//renode_image(false, &pkgs, extra_packages.as_slice(),
|
//renode_image(false, &pkgs, extra_packages.as_slice(),
|
||||||
//None, Some(&["--features", "renode-bypass"]))?;
|
//None, Some(&["--features", "renode-bypass"]))?;
|
||||||
|
|
@ -535,7 +536,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("perf-image") => {
|
Some("perf-image") => {
|
||||||
|
|
@ -554,10 +555,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
lkey,
|
lkey,
|
||||||
kkey,
|
kkey,
|
||||||
Some(&[
|
Some(&[
|
||||||
"--features", "perfcounter"
|
"--features", "perfcounter",
|
||||||
]),
|
]),
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("utra") => {
|
Some("utra") => {
|
||||||
|
|
@ -584,6 +585,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
std::env::set_var("XOUS_SVD_FILE", path.canonicalize().unwrap());
|
std::env::set_var("XOUS_SVD_FILE", path.canonicalize().unwrap());
|
||||||
println!("XOUS_SVD_FILE: {}", path.canonicalize().unwrap().display());
|
println!("XOUS_SVD_FILE: {}", path.canonicalize().unwrap().display());
|
||||||
}
|
}
|
||||||
|
let generated_path = std::path::Path::new("utralib/src/generated.rs");
|
||||||
|
// blank the contents so that the build command runs
|
||||||
|
std::fs::write(generated_path, "")?;
|
||||||
let status = Command::new(cargo())
|
let status = Command::new(cargo())
|
||||||
.current_dir(project_root())
|
.current_dir(project_root())
|
||||||
.args(&[
|
.args(&[
|
||||||
|
|
@ -615,7 +619,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
"--features", "ditherpunk",
|
"--features", "ditherpunk",
|
||||||
]),
|
]),
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("hw-image") => {
|
Some("hw-image") => {
|
||||||
|
|
@ -639,7 +643,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("gfx-dev") => run(
|
Some("gfx-dev") => run(
|
||||||
|
|
@ -656,7 +660,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?,
|
)?,
|
||||||
Some("pddb-hosted") => run(false, &pddb_dev_pkgs, None, false)?,
|
Some("pddb-hosted") => run(false, &pddb_dev_pkgs, None, false)?,
|
||||||
Some("benchmark") => build_hw_image(
|
Some("benchmark") => build_hw_image(
|
||||||
|
|
@ -667,7 +671,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?,
|
)?,
|
||||||
Some("minimal") => build_hw_image(
|
Some("minimal") => build_hw_image(
|
||||||
false,
|
false,
|
||||||
|
|
@ -677,7 +681,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?,
|
)?,
|
||||||
Some("cbtest") => build_hw_image(
|
Some("cbtest") => build_hw_image(
|
||||||
false,
|
false,
|
||||||
|
|
@ -687,7 +691,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?,
|
)?,
|
||||||
Some("trng-test") => {
|
Some("trng-test") => {
|
||||||
generate_app_menus(&Vec::<String>::new());
|
generate_app_menus(&Vec::<String>::new());
|
||||||
|
|
@ -699,7 +703,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
Some(&["--features", "urandomtest"]),
|
Some(&["--features", "urandomtest"]),
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("ro-test") => {
|
Some("ro-test") => {
|
||||||
|
|
@ -712,7 +716,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
Some(&["--features", "ringosctest"]),
|
Some(&["--features", "ringosctest"]),
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("av-test") => {
|
Some("av-test") => {
|
||||||
|
|
@ -725,7 +729,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
Some(&["--features", "avalanchetest"]),
|
Some(&["--features", "avalanchetest"]),
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?
|
)?
|
||||||
}
|
}
|
||||||
Some("sr-test") => build_hw_image(
|
Some("sr-test") => build_hw_image(
|
||||||
|
|
@ -736,7 +740,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
kkey,
|
kkey,
|
||||||
None,
|
None,
|
||||||
&[],
|
&[],
|
||||||
None,
|
None, None,
|
||||||
)?,
|
)?,
|
||||||
Some("burn-kernel") => update_usb(true, false, false, false)?,
|
Some("burn-kernel") => update_usb(true, false, false, false)?,
|
||||||
Some("burn-loader") => update_usb(false, true, false, false)?,
|
Some("burn-loader") => update_usb(false, true, false, false)?,
|
||||||
|
|
@ -952,6 +956,7 @@ fn build_hw_image(
|
||||||
extra_args: Option<&[&str]>,
|
extra_args: Option<&[&str]>,
|
||||||
extra_packages: &[&str],
|
extra_packages: &[&str],
|
||||||
loader_features: Option<&[&str]>,
|
loader_features: Option<&[&str]>,
|
||||||
|
kernel_features: Option<&[&str]>,
|
||||||
) -> Result<(), DynError> {
|
) -> Result<(), DynError> {
|
||||||
let svd_file = match svd {
|
let svd_file = match svd {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
|
|
@ -972,7 +977,7 @@ fn build_hw_image(
|
||||||
let loaderkey_file = lkey.unwrap_or_else(|| "devkey/dev.key".into());
|
let loaderkey_file = lkey.unwrap_or_else(|| "devkey/dev.key".into());
|
||||||
let kernelkey_file = kkey.unwrap_or_else(|| "devkey/dev.key".into());
|
let kernelkey_file = kkey.unwrap_or_else(|| "devkey/dev.key".into());
|
||||||
|
|
||||||
let kernel = build_kernel(debug)?;
|
let kernel = build_kernel(debug, kernel_features)?;
|
||||||
let mut init = vec![];
|
let mut init = vec![];
|
||||||
let base_path = build(
|
let base_path = build(
|
||||||
packages,
|
packages,
|
||||||
|
|
@ -1170,6 +1175,7 @@ fn renode_image(
|
||||||
xous_features,
|
xous_features,
|
||||||
extra_packages,
|
extra_packages,
|
||||||
loader_features,
|
loader_features,
|
||||||
|
None,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1234,8 +1240,8 @@ fn run(
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_kernel(debug: bool) -> Result<PathBuf, DynError> {
|
fn build_kernel(debug: bool, features: Option<&[&str]>) -> Result<PathBuf, DynError> {
|
||||||
let mut path = build(&["kernel"], debug, Some(KERNEL_TARGET), None, None, None)?;
|
let mut path = build(&["kernel"], debug, Some(KERNEL_TARGET), None, None, features)?;
|
||||||
path.push("kernel");
|
path.push("kernel");
|
||||||
Ok(path)
|
Ok(path)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue