Merge branch 'main' of github.com:betrusted-io/xous-core

This commit is contained in:
Sean Cross 2024-01-04 21:41:37 +08:00
commit f02d296ecc
19 changed files with 50 additions and 47 deletions

10
Cargo.lock generated
View file

@ -3805,6 +3805,15 @@ dependencies = [
"rand_core 0.5.1", "rand_core 0.5.1",
] ]
[[package]]
name = "rand_xorshift"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f"
dependencies = [
"rand_core 0.6.3",
]
[[package]] [[package]]
name = "random-number" name = "random-number"
version = "0.1.7" version = "0.1.7"
@ -4483,6 +4492,7 @@ dependencies = [
"png", "png",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rand_xorshift",
"random-pick", "random-pick",
"ring", "ring",
"rkyv", "rkyv",

View file

@ -441,6 +441,9 @@ perform the Xous firmware upgrade. This requires running manual update commands,
- Fix an issue where uninitialized memory is being returned from the kernel due to a pointer assumed to be pointing to `usize` actually pointing to `u8`, thus having its length incorrectly divided by the size of a `usize` - Fix an issue where uninitialized memory is being returned from the kernel due to a pointer assumed to be pointing to `usize` actually pointing to `u8`, thus having its length incorrectly divided by the size of a `usize`
## New in 0.9.16 ## New in 0.9.16
- Incorporate more stability fixes and formatting changes from @xobs
- Clean up warning and breakages due to Rust 1.75.0. Note that cleaning up one warning forces the code to be
backward-incompatible with earlier versions of Rust. 😖
## Roadmap ## Roadmap
- Lots of testing and bug fixes - Lots of testing and bug fixes

View file

@ -26,7 +26,7 @@ impl MemoryMapping {
} }
/// Get the "PID" (actually, ASID) from the current mapping /// Get the "PID" (actually, ASID) from the current mapping
pub fn get_pid(self) -> PID { pub fn get_pid(self) -> Option<PID> {
unimplemented!() unimplemented!()
} }

View file

@ -4,6 +4,7 @@
use crate::arch; use crate::arch;
use crate::arch::mem::MemoryMapping; use crate::arch::mem::MemoryMapping;
pub use crate::arch::process::Process as ArchProcess; pub use crate::arch::process::Process as ArchProcess;
#[cfg(not(any(windows, unix)))]
pub use crate::arch::process::Thread; pub use crate::arch::process::Thread;
use crate::platform; use crate::platform;
use xous_kernel::arch::ProcessStartup; use xous_kernel::arch::ProcessStartup;

View file

@ -5,6 +5,7 @@
// SPDX-LIcense-Identifier: Apache 2.0 // SPDX-LIcense-Identifier: Apache 2.0
#![no_std] #![no_std]
#![allow(unused_imports)]
pub use typenum::{ pub use typenum::{
Unsigned, U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, Unsigned, U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20,

View file

@ -4,6 +4,8 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// SPDX-LIcense-Identifier: Apache 2.0 // SPDX-LIcense-Identifier: Apache 2.0
#![allow(unused_imports)]
mod bool_pack; mod bool_pack;
pub use bool_pack::*; pub use bool_pack::*;

View file

@ -4,6 +4,8 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// SPDX-LIcense-Identifier: Apache 2.0 // SPDX-LIcense-Identifier: Apache 2.0
#![allow(unused_imports)]
mod op_code; mod op_code;
pub use op_code::*; pub use op_code::*;

View file

@ -69,6 +69,7 @@ pub use backend::serial::u32::field::*;
pub type FieldElement = backend::serial::u32::field::FieldElement2625; pub type FieldElement = backend::serial::u32::field::FieldElement2625;
#[cfg(feature = "u32e_backend")] #[cfg(feature = "u32e_backend")]
#[allow(unused_imports)] // this may be used by some other configs, so don't un-export it.
pub use backend::serial::u32e::field::*; pub use backend::serial::u32e::field::*;
/// A `FieldElement` represents an element of the field /// A `FieldElement` represents an element of the field
/// \\( \mathbb Z / (2\^{255} - 19)\\). /// \\( \mathbb Z / (2\^{255} - 19)\\).

View file

@ -4,4 +4,3 @@ pub mod locale;
pub use locale::LANG; pub use locale::LANG;
pub mod generated; pub mod generated;
pub use generated::*;

View file

@ -94,7 +94,8 @@ impl<'a> AlertModalBuilder<'a> {
final_placeholders = Some(pl) final_placeholders = Some(pl)
} }
0 => (), 0 => (),
_ => panic!("somehow len of placeholders was neither zero or >= 1...?"), // Note: if you are getting an error on compilation, this line below is required for Rust < 1.75.0
// _ => panic!("somehow len of placeholders was neither zero or >= 1...?"),
} }
let mut spec = ManagedPromptWithTextResponse { let mut spec = ManagedPromptWithTextResponse {

View file

@ -19,6 +19,7 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use xous_semver::SemVer; use xous_semver::SemVer;
// republish this so we can decode the icmpv4 error codes // republish this so we can decode the icmpv4 error codes
#[allow(unused_imports)]
pub use smoltcp::wire::Icmpv4DstUnreachable; pub use smoltcp::wire::Icmpv4DstUnreachable;
// note: this name cannot be changed, because it is baked into `libstd` // note: this name cannot be changed, because it is baked into `libstd`

View file

@ -11,7 +11,6 @@ pub use fastspace::*;
mod types; mod types;
pub use types::*; pub use types::*;
mod bcrypt; mod bcrypt;
pub use bcrypt::*;
// local to the backend // local to the backend
mod murmur3; mod murmur3;

View file

@ -144,7 +144,6 @@ pub enum RootkeyResult {
} }
/// AES operation definitions /// AES operation definitions
pub use cipher::{BlockCipher, consts::U16};
use keyboard::KeyMap; use keyboard::KeyMap;
use zeroize::Zeroize; use zeroize::Zeroize;

View file

@ -14,6 +14,7 @@ use std::convert::TryInto;
pub use cipher::{BlockSizeUser, BlockClosure, ParBlocksSizeUser, BlockBackend, pub use cipher::{BlockSizeUser, BlockClosure, ParBlocksSizeUser, BlockBackend,
BlockEncrypt, BlockDecrypt, consts::U16, inout::InOut, generic_array::GenericArray, BlockEncrypt, BlockDecrypt, consts::U16, inout::InOut, generic_array::GenericArray,
BlockCipher
}; };
pub(crate) type BatchBlocks = GenericArray<Block, U16>; pub(crate) type BatchBlocks = GenericArray<Block, U16>;

View file

@ -1,4 +1,4 @@
#![allow(dead_code)] #![allow(unused_imports)]
pub use xous_usb_hid::page::Keyboard as UsbKeyCode; pub use xous_usb_hid::page::Keyboard as UsbKeyCode;
#[cfg(any(feature="precursor", feature="renode"))] #[cfg(any(feature="precursor", feature="renode"))]

View file

@ -22,14 +22,18 @@ struct ConnectRequest {
#[cfg(feature = "usb")] #[cfg(feature = "usb")]
impl Default for ConnectRequest { impl Default for ConnectRequest {
fn default() -> Self { fn default() -> Self {
ConnectRequest { name: [0u8; 64], len: 0, _padding: [0u8; 4096 - 4 - 64] } ConnectRequest {
name: [0u8; 64],
len: 0,
_padding: [0u8; 4096 - 4 - 64],
}
} }
} }
#[cfg(feature = "usb")] #[cfg(feature = "usb")]
#[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)]
pub struct UsbString { pub struct UsbString {
pub s: xous_ipc::String::<4000>, pub s: xous_ipc::String<4000>,
pub sent: Option<u32>, pub sent: Option<u32>,
} }
@ -37,7 +41,7 @@ pub struct UsbString {
fn usb_send_str(conn: xous::CID, s: &str) { fn usb_send_str(conn: xous::CID, s: &str) {
let serializer = UsbString { let serializer = UsbString {
s: xous_ipc::String::<4000>::from_str(s), s: xous_ipc::String::<4000>::from_str(s),
sent: None sent: None,
}; };
let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error"); let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error");
// failures to send are silent & ignored; also, this API doesn't block. // failures to send are silent & ignored; also, this API doesn't block.
@ -120,7 +124,8 @@ fn reader_thread(arg: usize) {
writeln!(output, ")").ok(); writeln!(output, ")").ok();
#[cfg(feature = "usb")] #[cfg(feature = "usb")]
if let Some(conn) = usb_serial { if let Some(conn) = usb_serial {
if usb_str.len() > 0 { // test length so we aren't constantly copying 4096 bytes of 0's clearing an already cleared structure. if usb_str.len() > 0 {
// test length so we aren't constantly copying 4096 bytes of 0's clearing an already cleared structure.
usb_str.clear(); usb_str.clear();
} }
// duplicate the above code because doing repeated calls to the USB stack is inefficient // duplicate the above code because doing repeated calls to the USB stack is inefficient
@ -165,7 +170,12 @@ fn reader_thread(arg: usize) {
buffer_length, buffer_length,
) )
}; };
output.write_all(buffer).unwrap(); for c in buffer {
if *c == b'\n' {
output.putc(b'\r');
}
output.putc(*c);
}
// TODO: If the buffer is mutable, set `length` to 0. // TODO: If the buffer is mutable, set `length` to 0.
#[cfg(feature = "usb")] #[cfg(feature = "usb")]

View file

@ -71,20 +71,6 @@ impl OutputWriter {
pub fn putc(&self, c: u8) { pub fn putc(&self, c: u8) {
self.tx.send(ControlMessage::Byte(c)).unwrap(); self.tx.send(ControlMessage::Byte(c)).unwrap();
} }
/// Write a buffer to the output and return the number of
/// bytes written. This is mostly compatible with `std::io::Write`,
/// except it is infallible.
pub fn write(&mut self, buf: &[u8]) -> usize {
for c in buf {
self.putc(*c);
}
buf.len()
}
pub fn write_all(&mut self, buf: &[u8]) -> core::result::Result<usize, ()> {
Ok(self.write(buf))
}
} }
impl Write for OutputWriter { impl Write for OutputWriter {

View file

@ -105,20 +105,6 @@ impl OutputWriter {
// uart_csr.wfo(utra::uart::EV_PENDING_RX, 1); // uart_csr.wfo(utra::uart::EV_PENDING_RX, 1);
} }
} }
/// Write a buffer to the output and return the number of
/// bytes written. This is mostly compatible with `std::io::Write`,
/// except it is infallible.
pub fn write(&mut self, buf: &[u8]) -> usize {
for c in buf {
self.putc(*c);
}
buf.len()
}
pub fn write_all(&mut self, buf: &[u8]) -> core::result::Result<usize, ()> {
Ok(self.write(buf))
}
} }
impl Write for OutputWriter { impl Write for OutputWriter {

View file

@ -1,3 +1,4 @@
#![cfg_attr(any(target_os = "none", not(feature = "std")), no_std)] #![cfg_attr(any(target_os = "none", not(feature = "std")), no_std)]
pub mod generated; pub mod generated;
#[cfg(not(any(windows, unix)))]
pub use generated::*; pub use generated::*;