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",
]
[[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]]
name = "random-number"
version = "0.1.7"
@ -4483,6 +4492,7 @@ dependencies = [
"png",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rand_xorshift",
"random-pick",
"ring",
"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`
## 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
- Lots of testing and bug fixes

View file

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

View file

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

View file

@ -5,6 +5,7 @@
// SPDX-LIcense-Identifier: Apache 2.0
#![no_std]
#![allow(unused_imports)]
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,

View file

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

View file

@ -4,6 +4,8 @@
// SPDX-License-Identifier: MIT
// SPDX-LIcense-Identifier: Apache 2.0
#![allow(unused_imports)]
mod 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;
#[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::*;
/// A `FieldElement` represents an element of the field
/// \\( \mathbb Z / (2\^{255} - 19)\\).

View file

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

View file

@ -94,7 +94,8 @@ impl<'a> AlertModalBuilder<'a> {
final_placeholders = Some(pl)
}
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 {

View file

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

View file

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

View file

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

View file

@ -14,6 +14,7 @@ use std::convert::TryInto;
pub use cipher::{BlockSizeUser, BlockClosure, ParBlocksSizeUser, BlockBackend,
BlockEncrypt, BlockDecrypt, consts::U16, inout::InOut, generic_array::GenericArray,
BlockCipher
};
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;
#[cfg(any(feature="precursor", feature="renode"))]

View file

@ -12,32 +12,36 @@ use num_traits::FromPrimitive;
use platform::implementation;
/// A page-aligned stack allocation for connection requests (used by USB resolver)
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
#[repr(C, align(4096))]
struct ConnectRequest {
name: [u8; 64],
len: u32,
_padding: [u8; 4096 - 4 - 64],
}
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
impl Default for ConnectRequest {
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)]
pub struct UsbString {
pub s: xous_ipc::String::<4000>,
pub s: xous_ipc::String<4000>,
pub sent: Option<u32>,
}
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
fn usb_send_str(conn: xous::CID, s: &str) {
let serializer = UsbString {
s: xous_ipc::String::<4000>::from_str(s),
sent: None
sent: None,
};
let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error");
// failures to send are silent & ignored; also, this API doesn't block.
@ -49,10 +53,10 @@ fn reader_thread(arg: usize) {
writeln!(output, "LOG: Xous Logging Server starting up...").ok();
let server_addr = xous::create_server_with_address(b"xous-log-server ").expect("create server");
writeln!(output, "LOG: Server listening on address {:?}", server_addr).ok();
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
let mut usb_serial: Option<xous::CID> = None;
// use a stack-allocated string to ensure no heap thrashing results from String manipulations
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
let mut usb_str = xous_ipc::String::<4000>::new();
println!("LOG: my PID is {}", xous::process::id());
@ -118,9 +122,10 @@ fn reader_thread(arg: usize) {
write!(output, ":{}", line.get()).ok();
}
writeln!(output, ")").ok();
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
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();
}
// duplicate the above code because doing repeated calls to the USB stack is inefficient
@ -165,10 +170,15 @@ fn reader_thread(arg: usize) {
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.
#[cfg(feature="usb")]
#[cfg(feature = "usb")]
if let Some(conn) = usb_serial {
// safety: this routine will just blow up if you try to pass non utf-8 to it,
// so it's not very safe. On the other hand, it's fast and shame on you for sending

View file

@ -71,20 +71,6 @@ impl OutputWriter {
pub fn putc(&self, c: u8) {
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 {

View file

@ -105,20 +105,6 @@ impl OutputWriter {
// 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 {

View file

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