From ed4ec01017b56ecddb25179cb35b3d7bfd4a105e Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Tue, 6 Feb 2024 10:28:33 +0800 Subject: [PATCH] kernel: support `riscv32imac-unknown-none-elf` With Rust 1.76.0, we no longer support building with `#![no_std]` or `panic = "abort"`, both of which are required within the kernel. As a workaround, go back to building the kernel under `riscv32imac-unknown-none-elf`. Signed-off-by: Sean Cross --- kernel/src/arch/mod.rs | 4 ++-- kernel/src/main.rs | 2 +- kernel/src/services.rs | 2 +- kernel/src/syscall.rs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/src/arch/mod.rs b/kernel/src/arch/mod.rs index 750a5ecfd..21590b5b7 100644 --- a/kernel/src/arch/mod.rs +++ b/kernel/src/arch/mod.rs @@ -16,9 +16,9 @@ mod riscv; #[cfg(target_arch = "riscv32")] pub use crate::arch::riscv::*; -#[cfg(all(target_arch = "riscv64", not(target_os = "xous")))] +#[cfg(all(target_arch = "riscv64", not(baremetal)))] mod riscv; -#[cfg(all(target_arch = "riscv64", not(target_os = "xous")))] +#[cfg(all(target_arch = "riscv64", not(baremetal)))] pub use riscv::*; #[cfg(all(target_arch = "x86_64", not(any(windows, unix))))] diff --git a/kernel/src/main.rs b/kernel/src/main.rs index eff27e065..0043492fb 100644 --- a/kernel/src/main.rs +++ b/kernel/src/main.rs @@ -87,7 +87,7 @@ pub extern "C" fn kmain() { // Note that at this point, no new direct children of INIT may be created. let mut pid = None; - #[cfg(not(any(target_os = "none", target_os = "xous", all(ci, test))))] + #[cfg(not(any(baremetal, all(ci, test))))] { use std::panic; panic::set_hook(Box::new(|arg| { diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 7e1ddfa57..6bd0ad6de 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -876,7 +876,7 @@ impl SystemServices { } // Activate this process on this CPU - #[cfg(not(target_os = "xous"))] + #[cfg(not(baremetal))] process.activate()?; ArchProcess::current().set_tid(new_thread)?; process.current_thread = new_thread as _; diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs index 9f9c51d8d..c317eee6e 100644 --- a/kernel/src/syscall.rs +++ b/kernel/src/syscall.rs @@ -175,7 +175,7 @@ fn send_message(pid: PID, tid: TID, cid: CID, message: Message) -> SysCallResult // Mark the server's context as "Ready". If this fails, return the context // to the blocking list. - #[cfg(target_os = "xous")] + #[cfg(baremetal)] ss.ready_thread(server_pid, server_tid).map_err(|e| { ss.server_from_sidx_mut(sidx) .expect("server couldn't be located") @@ -883,7 +883,7 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR SysCall::CreateThread(thread_init) => SystemServices::with_mut(|ss| { ss.create_thread(pid, thread_init).map(|new_tid| { // Set the return value of the existing thread to be the new thread ID - if cfg!(target_os = "xous") { + if cfg!(baremetal) { // Immediately switch to the new thread ss.switch_to_thread(pid, Some(new_tid)).expect("couldn't activate new thread"); ss.set_thread_result(pid, tid, xous_kernel::Result::ThreadID(new_tid))