mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
xous: rename Message to MessageEnvelope
This reflects the fact that up until now, the `Message` struct has merely been the envelope that surrounds the message. It does not contain any actual Message contents. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
49ce85f9a8
commit
d463f9563f
5 changed files with 21 additions and 30 deletions
|
|
@ -233,7 +233,7 @@ fn read_next_syscall_result(
|
|||
|
||||
// If the client is passing us memory, read bytes from the data, then
|
||||
// remap the addresses to function in our address space.
|
||||
if let Result::Message(msg) = &mut response {
|
||||
if let Result::MessageEnvelope(msg) = &mut response {
|
||||
match &mut msg.body {
|
||||
crate::Message::Move(ref mut memory_message)
|
||||
| crate::Message::Borrow(ref mut memory_message)
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ fn _xous_syscall_result(ret: &mut Result, thread_id: TID, server_connection: &Se
|
|||
});
|
||||
|
||||
// If the client is passing us memory, remap the array to our own space.
|
||||
if let Result::Message(msg) = &mut response {
|
||||
if let Result::MessageEnvelope(msg) = &mut response {
|
||||
match &mut msg.body {
|
||||
crate::Message::Move(ref mut memory_message)
|
||||
| crate::Message::Borrow(ref mut memory_message)
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ pub enum Result {
|
|||
NewServerID(SID, CID),
|
||||
|
||||
// 9
|
||||
Message(MessageEnvelope),
|
||||
MessageEnvelope(MessageEnvelope),
|
||||
|
||||
// 10
|
||||
ThreadID(TID),
|
||||
|
|
@ -488,7 +488,7 @@ impl Result {
|
|||
[6, s.0 as _, s.1 as _, s.2 as _, s.3 as _, 0, 0, 0]
|
||||
}
|
||||
Result::ConnectionID(cid) => [7, *cid as usize, 0, 0, 0, 0, 0, 0],
|
||||
Result::Message(me) => {
|
||||
Result::MessageEnvelope(me) => {
|
||||
let me_enc = me.to_usize();
|
||||
[
|
||||
9, me_enc[0], me_enc[1], me_enc[2], me_enc[3], me_enc[4], me_enc[5], me_enc[6],
|
||||
|
|
@ -589,7 +589,7 @@ impl Result {
|
|||
)),
|
||||
_ => return Result::Error(Error::InternalError),
|
||||
};
|
||||
Result::Message(MessageEnvelope {
|
||||
Result::MessageEnvelope(MessageEnvelope {
|
||||
sender: MessageSender::from_usize(sender),
|
||||
body: message,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -10,21 +10,15 @@ pub struct Envelope {
|
|||
|
||||
impl Envelope {
|
||||
pub fn to_usize(&self) -> [usize; 7] {
|
||||
let ret = match &self.body {
|
||||
Message::MutableBorrow(m) => (0, m.to_usize()),
|
||||
Message::Borrow(m) => (1, m.to_usize()),
|
||||
Message::Move(m) => (2, m.to_usize()),
|
||||
Message::Scalar(m) => (3, m.to_usize()),
|
||||
Message::BlockingScalar(m) => (4, m.to_usize()),
|
||||
};
|
||||
let body_usize = self.body.to_usize();
|
||||
[
|
||||
self.sender.to_usize(),
|
||||
ret.0,
|
||||
ret.1[0],
|
||||
ret.1[1],
|
||||
ret.1[2],
|
||||
ret.1[3],
|
||||
ret.1[4],
|
||||
body_usize[0],
|
||||
body_usize[1],
|
||||
body_usize[2],
|
||||
body_usize[3],
|
||||
body_usize[4],
|
||||
body_usize[5],
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ pub enum SysCall {
|
|||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * **Message**: A valid message from the queue
|
||||
/// * **MessageEnvelope**: A valid message from the queue
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
|
|
@ -1570,7 +1570,7 @@ pub fn try_connect(server: SID) -> core::result::Result<CID, Error> {
|
|||
///
|
||||
pub fn receive_message(server: SID) -> core::result::Result<MessageEnvelope, Error> {
|
||||
let result = rsyscall(SysCall::ReceiveMessage(server)).expect("Couldn't call ReceiveMessage");
|
||||
if let Result::Message(envelope) = result {
|
||||
if let Result::MessageEnvelope(envelope) = result {
|
||||
Ok(envelope)
|
||||
} else if let Result::Error(e) = result {
|
||||
Err(e)
|
||||
|
|
@ -1587,7 +1587,7 @@ pub fn receive_message(server: SID) -> core::result::Result<MessageEnvelope, Err
|
|||
pub fn try_receive_message(server: SID) -> core::result::Result<Option<MessageEnvelope>, Error> {
|
||||
let result =
|
||||
rsyscall(SysCall::TryReceiveMessage(server)).expect("Couldn't call ReceiveMessage");
|
||||
if let Result::Message(envelope) = result {
|
||||
if let Result::MessageEnvelope(envelope) = result {
|
||||
Ok(Some(envelope))
|
||||
} else if result == Result::None {
|
||||
Ok(None)
|
||||
|
|
@ -1617,6 +1617,7 @@ pub fn try_send_message(connection: CID, message: Message) -> core::result::Resu
|
|||
Ok(Result::Scalar2(a, b)) => Ok(Result::Scalar2(a, b)),
|
||||
Ok(Result::Scalar5(a, b, c, d, e)) => Ok(Result::Scalar5(a, b, c, d, e)),
|
||||
Ok(Result::MemoryReturned(offset, valid)) => Ok(Result::MemoryReturned(offset, valid)),
|
||||
Ok(Result::MessageEnvelope(msg)) => Ok(Result::MessageEnvelope(msg)),
|
||||
Err(e) => Err(e),
|
||||
v => panic!("Unexpected return value: {:?}", v),
|
||||
}
|
||||
|
|
@ -1946,16 +1947,12 @@ pub fn reply_and_receive_next(
|
|||
} else {
|
||||
panic!("unrecognized message type")
|
||||
};
|
||||
let call = SysCall::ReplyAndReceiveNext(
|
||||
envelope.sender,
|
||||
args[0],
|
||||
args[1],
|
||||
args[2],
|
||||
args[3],
|
||||
args[4],
|
||||
);
|
||||
let sender = envelope.sender;
|
||||
core::mem::forget(envelope);
|
||||
let call =
|
||||
SysCall::ReplyAndReceiveNext(sender, args[0], args[1], args[2], args[3], args[4], rt);
|
||||
match rsyscall(call) {
|
||||
Ok(crate::Result::Message(envelope)) => {
|
||||
Ok(crate::Result::MessageEnvelope(envelope)) => {
|
||||
*msg = Some(envelope);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue