From 40651a37ea50a9029afe22e26b28d00ca490f4eb Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 13 Jun 2024 15:42:18 +0800 Subject: [PATCH] add RawTrng syscall implementation --- kernel/src/syscall.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kernel/src/syscall.rs b/kernel/src/syscall.rs index ac28ed2a5..3fdae5454 100644 --- a/kernel/src/syscall.rs +++ b/kernel/src/syscall.rs @@ -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| {