MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / from_values

Method from_values

euralios_std/src/message.rs:126–160  ·  view source on GitHub ↗

Reconstruct a Message from register values returned by a receive syscall. This should be the inverse of to_values, and consistent with the kernel Message implementation.

(
        ctrl: u64,
        data1: u64, data2: u64, data3: u64
    )

Source from the content-addressed store, hash-verified

124 /// This should be the inverse of to_values, and consistent with
125 /// the kernel Message implementation.
126 pub fn from_values(
127 ctrl: u64,
128 data1: u64, data2: u64, data3: u64
129 ) -> Message {
130 if ctrl & MESSAGE_LONG == 0 {
131 Message::Short(data1, data2, data3)
132 } else {
133 Message::Long(
134 data1,
135 match ctrl & MESSAGE_DATA2_TYPE {
136 MESSAGE_DATA2_RDV =>
137 MessageData::CommHandle(
138 CommHandle::new(data2 as u32)),
139 MESSAGE_DATA2_MEM =>
140 MessageData::MemoryHandle(
141 MemoryHandle::new(data2)),
142 MESSAGE_DATA2_ERR =>
143 MessageData::Error(
144 SyscallError::new(data2)),
145 _ => MessageData::Value(data2)
146 },
147 match ctrl & MESSAGE_DATA3_TYPE {
148 MESSAGE_DATA3_RDV =>
149 MessageData::CommHandle(
150 CommHandle::new(data3 as u32)),
151 MESSAGE_DATA3_MEM =>
152 MessageData::MemoryHandle(
153 MemoryHandle::new(data3)),
154 MESSAGE_DATA3_ERR =>
155 MessageData::Error(
156 SyscallError::new(data3)),
157 _ => MessageData::Value(data3)
158 })
159 }
160 }
161}
162
163/// Remote call.

Callers

nothing calls this directly

Calls 2

CommHandleClass · 0.85
MemoryHandleClass · 0.85

Tested by

no test coverage detected