[zion] Move IPC objects to share code
This commit is contained in:
parent
58df2c0ed2
commit
9dd457391c
14 changed files with 125 additions and 196 deletions
|
|
@ -21,7 +21,7 @@ z_err_t ChannelSend(ZChannelSendReq* req) {
|
|||
RET_ERR(ValidateCapability<Channel>(chan_cap, ZC_WRITE));
|
||||
|
||||
auto chan = chan_cap->obj<Channel>();
|
||||
return chan->Write(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return chan->Send(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
||||
z_err_t ChannelRecv(ZChannelRecvReq* req) {
|
||||
|
|
@ -30,7 +30,7 @@ z_err_t ChannelRecv(ZChannelRecvReq* req) {
|
|||
RET_ERR(ValidateCapability<Channel>(chan_cap, ZC_READ));
|
||||
|
||||
auto chan = chan_cap->obj<Channel>();
|
||||
return chan->Read(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return chan->Recv(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
||||
z_err_t PortCreate(ZPortCreateReq* req) {
|
||||
|
|
@ -46,7 +46,7 @@ z_err_t PortSend(ZPortSendReq* req) {
|
|||
RET_ERR(ValidateCapability<Port>(port_cap, ZC_WRITE));
|
||||
|
||||
auto port = port_cap->obj<Port>();
|
||||
return port->Write(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return port->Send(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
||||
z_err_t PortRecv(ZPortRecvReq* req) {
|
||||
|
|
@ -61,7 +61,7 @@ z_err_t PortRecv(ZPortRecvReq* req) {
|
|||
.num_caps = *req->num_caps,
|
||||
.caps = req->caps,
|
||||
};
|
||||
return port->Read(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return port->Recv(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
||||
z_err_t PortPoll(ZPortPollReq* req) {
|
||||
|
|
@ -75,7 +75,7 @@ z_err_t PortPoll(ZPortPollReq* req) {
|
|||
if (!port->HasMessages()) {
|
||||
return glcr::EMPTY;
|
||||
}
|
||||
return port->Read(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return port->Recv(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
||||
z_err_t IrqRegister(ZIrqRegisterReq* req) {
|
||||
|
|
@ -107,7 +107,7 @@ glcr::ErrorCode EndpointSend(ZEndpointSendReq* req) {
|
|||
auto reply_port = ReplyPort::Create();
|
||||
*req->reply_port_cap = proc.AddNewCapability(reply_port, ZC_READ);
|
||||
uint64_t reply_port_cap_to_send = proc.AddNewCapability(reply_port, ZC_WRITE);
|
||||
return endpoint->Write(req->num_bytes, req->data, reply_port_cap_to_send);
|
||||
return endpoint->Send(req->num_bytes, req->data, 1, &reply_port_cap_to_send);
|
||||
}
|
||||
|
||||
glcr::ErrorCode EndpointRecv(ZEndpointRecvReq* req) {
|
||||
|
|
@ -117,7 +117,13 @@ glcr::ErrorCode EndpointRecv(ZEndpointRecvReq* req) {
|
|||
ValidateCapability<Endpoint>(endpoint_cap, ZC_READ);
|
||||
auto endpoint = endpoint_cap->obj<Endpoint>();
|
||||
|
||||
return endpoint->Read(req->num_bytes, req->data, req->reply_port_cap);
|
||||
uint64_t num_caps = 1;
|
||||
RET_ERR(endpoint->Recv(req->num_bytes, req->data, &num_caps,
|
||||
req->reply_port_cap));
|
||||
if (num_caps != 1) {
|
||||
return glcr::INTERNAL;
|
||||
}
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
glcr::ErrorCode ReplyPortSend(ZReplyPortSendReq* req) {
|
||||
|
|
@ -126,7 +132,7 @@ glcr::ErrorCode ReplyPortSend(ZReplyPortSendReq* req) {
|
|||
ValidateCapability<ReplyPort>(reply_port_cap, ZC_WRITE);
|
||||
auto reply_port = reply_port_cap->obj<ReplyPort>();
|
||||
|
||||
return reply_port->Write(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return reply_port->Send(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
glcr::ErrorCode ReplyPortRecv(ZReplyPortRecvReq* req) {
|
||||
auto& proc = gScheduler->CurrentProcess();
|
||||
|
|
@ -135,5 +141,5 @@ glcr::ErrorCode ReplyPortRecv(ZReplyPortRecvReq* req) {
|
|||
ValidateCapability<ReplyPort>(reply_port_cap, ZC_READ);
|
||||
auto reply_port = reply_port_cap->obj<ReplyPort>();
|
||||
|
||||
return reply_port->Read(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
return reply_port->Recv(req->num_bytes, req->data, req->num_caps, req->caps);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue