[zion] Move channel syscalls to new format.

This commit is contained in:
Drew Galbraith 2023-06-20 14:41:44 -07:00
parent 1a70ce4855
commit 77bb3acfb4
11 changed files with 91 additions and 123 deletions

View file

@ -19,48 +19,6 @@ z_err_t SysCall1(uint64_t number, const void* first) {
return SysCall2(number, first, 0);
}
z_err_t ZChannelCreate(z_cap_t* channel1, z_cap_t* channel2) {
ZChannelCreateResp resp;
z_err_t ret = SysCall2(Z_CHANNEL_CREATE, 0, &resp);
*channel1 = resp.chan_cap1;
*channel2 = resp.chan_cap2;
return ret;
}
z_err_t ZChannelSend(z_cap_t chan_cap, uint64_t num_bytes, const void* data,
uint64_t num_caps, const z_cap_t* caps) {
ZChannelSendReq req{
.chan_cap = chan_cap,
.message =
{
.num_bytes = num_bytes,
.data = const_cast<void*>(data),
.num_caps = num_caps,
.caps = const_cast<z_cap_t*>(caps),
},
};
return SysCall1(Z_CHANNEL_SEND, &req);
}
z_err_t ZChannelRecv(z_cap_t chan_cap, uint64_t num_bytes, void* data,
uint64_t num_caps, z_cap_t* caps, uint64_t* actual_bytes,
uint64_t* actual_caps) {
ZChannelRecvReq req{
.chan_cap = chan_cap,
.message =
{
.num_bytes = num_bytes,
.data = data,
.num_caps = num_caps,
.caps = caps,
},
};
z_err_t ret = SysCall1(Z_CHANNEL_RECV, &req);
*actual_bytes = req.message.num_bytes;
*actual_caps = req.message.num_caps;
return ret;
}
z_err_t ZPortCreate(z_cap_t* port_cap) {
ZPortCreateResp resp;
z_err_t ret = SysCall2(Z_PORT_CREATE, 0, &resp);