add RawTrng syscall implementation

This commit is contained in:
bunnie 2024-06-13 15:42:18 +08:00
parent a5322eaa7a
commit 40651a37ea

View file

@ -5,7 +5,6 @@ use core::sync::atomic::{AtomicU8, AtomicUsize, Ordering::Relaxed};
use xous_kernel::*;
use crate::arch;
use crate::arch::process::Process as ArchProcess;
use crate::irq::{interrupt_claim, interrupt_free};
use crate::mem::{MemoryManager, PAGE_SIZE};
@ -13,6 +12,7 @@ use crate::server::{SenderID, WaitingMessage};
use crate::services::SystemServices;
#[cfg(feature = "swap")]
use crate::swap::{Swap, SwapAbi};
use crate::{arch, platform};
/* Quoth Xobs:
The idea behind SWITCHTO_CALLER was that you'd have a process act as a scheduler,
@ -1104,6 +1104,18 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
}
}
}
#[cfg(feature = "raw-trng")]
SysCall::RawTrng(_a1, _a2, _a3, _a4, _a5, _a6, _a7) => {
// TODO: implement this platform call for other targets
// Right now, there is no get_raw_u32() for precursor/renode/hosted
Ok(xous_kernel::Result::Scalar5(
platform::rand::get_raw_u32() as usize,
platform::rand::get_raw_u32() as usize,
platform::rand::get_raw_u32() as usize,
platform::rand::get_raw_u32() as usize,
0,
))
}
/* https://github.com/betrusted-io/xous-core/issues/90
SysCall::SetExceptionHandler(pc, sp) => SystemServices::with_mut(|ss| {