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 <sean@xobs.io>
This commit is contained in:
Sean Cross 2024-02-06 10:28:33 +08:00
parent 058db866fe
commit ed4ec01017
4 changed files with 6 additions and 6 deletions

View file

@ -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))))]

View file

@ -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| {

View file

@ -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 _;

View file

@ -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))