From 74b3fde198b0a128ac5456575114278735059e9f Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 30 Oct 2020 10:14:43 +0800 Subject: [PATCH] kernel: add memory from Results to network packets If a Result contains attached memory, add that memory on to the network packet that gets sent by the kernel. Signed-off-by: Sean Cross --- kernel/src/arch/hosted.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/src/arch/hosted.rs b/kernel/src/arch/hosted.rs index f173e0f08..1b4f1c36f 100644 --- a/kernel/src/arch/hosted.rs +++ b/kernel/src/arch/hosted.rs @@ -570,6 +570,10 @@ pub fn idle() -> bool { for word in response.to_args().iter_mut() { response_vec.extend_from_slice(&word.to_le_bytes()); } + if let Some(mem) = response.memory() { + let s = unsafe { core::slice::from_raw_parts(mem.as_ptr(), mem.len()) }; + response_vec.extend_from_slice(s); + } process.send(&response_vec).unwrap_or_else(|_e| { // If we're unable to send data to the process, assume it's dead and terminate it. eprintln!(