mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
kernel: hosted: handle TrySendMessage the same as SendMessage
With the introduction of TrySendMessage, the kernel needs to know that this data structure should be transmitted over the wire in the same manner as SendMessage. Previously it was not special-casing this, which resulted in memory errors. Signed-off-by: Sean <xobs@ci.betrusted.io>
This commit is contained in:
parent
2dc0545eaa
commit
3e6d3904fb
1 changed files with 35 additions and 32 deletions
|
|
@ -101,7 +101,8 @@ fn handle_connection(
|
||||||
*word = usize::from_le_bytes(bytes.try_into().unwrap());
|
*word = usize::from_le_bytes(bytes.try_into().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
if packet_data[1] == 16
|
if (packet_data[1] == xous_kernel::syscall::SysCallNumber::SendMessage as _
|
||||||
|
|| packet_data[1] == xous_kernel::syscall::SysCallNumber::TrySendMessage as _)
|
||||||
&& (packet_data[3] == 1 || packet_data[3] == 2 || packet_data[3] == 3)
|
&& (packet_data[3] == 1 || packet_data[3] == 2 || packet_data[3] == 3)
|
||||||
{
|
{
|
||||||
let mut v = vec![0; packet_data[6]];
|
let mut v = vec![0; packet_data[6]];
|
||||||
|
|
@ -180,7 +181,9 @@ fn handle_connection(
|
||||||
// "Received packet: {:08x} {} {} {} {} {} {} {}: {:?}",
|
// "Received packet: {:08x} {} {} {} {} {} {} {}: {:?}",
|
||||||
// pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5], pkt[6], pkt[7], call
|
// pkt[0], pkt[1], pkt[2], pkt[3], pkt[4], pkt[5], pkt[6], pkt[7], call
|
||||||
// );
|
// );
|
||||||
if let SysCall::SendMessage(ref _cid, ref mut envelope) = call {
|
match call {
|
||||||
|
SysCall::SendMessage(ref _cid, ref mut envelope)
|
||||||
|
| SysCall::TrySendMessage(ref _cid, ref mut envelope) => {
|
||||||
match envelope {
|
match envelope {
|
||||||
xous_kernel::Message::MutableBorrow(msg)
|
xous_kernel::Message::MutableBorrow(msg)
|
||||||
| xous_kernel::Message::Borrow(msg)
|
| xous_kernel::Message::Borrow(msg)
|
||||||
|
|
@ -211,8 +214,8 @@ fn handle_connection(
|
||||||
}
|
}
|
||||||
xous_kernel::Message::Scalar(_) => (),
|
xous_kernel::Message::Scalar(_) => (),
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
panic!("unsupported message type");
|
_ => panic!("unsupported message type"),
|
||||||
}
|
}
|
||||||
chn.send(ThreadMessage::SysCall(pid, thread_id, call))
|
chn.send(ThreadMessage::SysCall(pid, thread_id, call))
|
||||||
.expect("couldn't make syscall");
|
.expect("couldn't make syscall");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue