[Zion] Use the glacier ArrayView class for sending IPC msgs.
This commit is contained in:
parent
6feb13d042
commit
277b0d3ccc
|
@ -153,7 +153,7 @@ glcr::RefPtr<Port> pci1_port;
|
||||||
extern "C" void isr_pci1();
|
extern "C" void isr_pci1();
|
||||||
extern "C" void interrupt_pci1(InterruptFrame*) {
|
extern "C" void interrupt_pci1(InterruptFrame*) {
|
||||||
dbgln("Interrupt PCI line 1");
|
dbgln("Interrupt PCI line 1");
|
||||||
pci1_port->Send(0, nullptr, 0, nullptr);
|
pci1_port->Send({}, {});
|
||||||
gApic->SignalEOI();
|
gApic->SignalEOI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,30 +3,24 @@
|
||||||
#include "debug/debug.h"
|
#include "debug/debug.h"
|
||||||
#include "scheduler/scheduler.h"
|
#include "scheduler/scheduler.h"
|
||||||
|
|
||||||
glcr::ErrorCode UnboundedMessageQueue::PushBack(uint64_t num_bytes,
|
glcr::ErrorCode UnboundedMessageQueue::PushBack(
|
||||||
const void* bytes,
|
const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps,
|
const glcr::ArrayView<z_cap_t>& caps, z_cap_t reply_cap) {
|
||||||
const z_cap_t* caps,
|
if (message.size() > 0x1000) {
|
||||||
z_cap_t reply_cap) {
|
dbgln("Large message size unimplemented: %x", message.size());
|
||||||
if (num_bytes > 0x1000) {
|
|
||||||
dbgln("Large message size unimplemented: %x", num_bytes);
|
|
||||||
return glcr::UNIMPLEMENTED;
|
return glcr::UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto message = glcr::MakeShared<Message>();
|
auto msg_struct = glcr::MakeShared<Message>();
|
||||||
message->num_bytes = num_bytes;
|
msg_struct->message = glcr::Array<uint8_t>(message);
|
||||||
message->bytes = new uint8_t[num_bytes];
|
|
||||||
for (uint64_t i = 0; i < num_bytes; i++) {
|
|
||||||
message->bytes[i] = static_cast<const uint8_t*>(bytes)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply_cap != kZionInvalidCapability) {
|
if (reply_cap != kZionInvalidCapability) {
|
||||||
// FIXME: We're just trusting that capability has the correct permissions.
|
// FIXME: We're just trusting that capability has the correct permissions.
|
||||||
message->reply_cap =
|
msg_struct->reply_cap =
|
||||||
gScheduler->CurrentProcess().ReleaseCapability(reply_cap);
|
gScheduler->CurrentProcess().ReleaseCapability(reply_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint64_t i = 0; i < num_caps; i++) {
|
for (uint64_t i = 0; i < caps.size(); i++) {
|
||||||
// FIXME: This would feel safer closer to the relevant syscall.
|
// FIXME: This would feel safer closer to the relevant syscall.
|
||||||
// FIXME: Race conditions on get->check->release here. Would be better to
|
// FIXME: Race conditions on get->check->release here. Would be better to
|
||||||
// have that as a single call on the process. (This pattern repeats other
|
// have that as a single call on the process. (This pattern repeats other
|
||||||
|
@ -39,11 +33,11 @@ glcr::ErrorCode UnboundedMessageQueue::PushBack(uint64_t num_bytes,
|
||||||
return glcr::CAP_PERMISSION_DENIED;
|
return glcr::CAP_PERMISSION_DENIED;
|
||||||
}
|
}
|
||||||
cap = gScheduler->CurrentProcess().ReleaseCapability(caps[i]);
|
cap = gScheduler->CurrentProcess().ReleaseCapability(caps[i]);
|
||||||
message->caps.PushBack(cap);
|
msg_struct->caps.PushBack(cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexHolder h(mutex_);
|
MutexHolder h(mutex_);
|
||||||
pending_messages_.PushBack(message);
|
pending_messages_.PushBack(msg_struct);
|
||||||
|
|
||||||
if (blocked_threads_.size() > 0) {
|
if (blocked_threads_.size() > 0) {
|
||||||
auto thread = blocked_threads_.PopFront();
|
auto thread = blocked_threads_.PopFront();
|
||||||
|
@ -70,7 +64,7 @@ glcr::ErrorCode UnboundedMessageQueue::PopFront(uint64_t* num_bytes,
|
||||||
|
|
||||||
MutexHolder lock(mutex_);
|
MutexHolder lock(mutex_);
|
||||||
auto next_msg = pending_messages_.PeekFront();
|
auto next_msg = pending_messages_.PeekFront();
|
||||||
if (next_msg->num_bytes > *num_bytes) {
|
if (next_msg->message.size() > *num_bytes) {
|
||||||
return glcr::BUFFER_SIZE;
|
return glcr::BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
if (next_msg->caps.size() > *num_caps) {
|
if (next_msg->caps.size() > *num_caps) {
|
||||||
|
@ -79,10 +73,10 @@ glcr::ErrorCode UnboundedMessageQueue::PopFront(uint64_t* num_bytes,
|
||||||
|
|
||||||
next_msg = pending_messages_.PopFront();
|
next_msg = pending_messages_.PopFront();
|
||||||
|
|
||||||
*num_bytes = next_msg->num_bytes;
|
*num_bytes = next_msg->message.size();
|
||||||
|
|
||||||
for (uint64_t i = 0; i < *num_bytes; i++) {
|
for (uint64_t i = 0; i < *num_bytes; i++) {
|
||||||
static_cast<uint8_t*>(bytes)[i] = next_msg->bytes[i];
|
static_cast<uint8_t*>(bytes)[i] = next_msg->message[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& proc = gScheduler->CurrentProcess();
|
auto& proc = gScheduler->CurrentProcess();
|
||||||
|
@ -105,40 +99,32 @@ void UnboundedMessageQueue::WriteKernel(uint64_t init,
|
||||||
glcr::RefPtr<Capability> cap) {
|
glcr::RefPtr<Capability> cap) {
|
||||||
// FIXME: Add synchronization here in case it is ever used outside of init.
|
// FIXME: Add synchronization here in case it is ever used outside of init.
|
||||||
auto msg = glcr::MakeShared<Message>();
|
auto msg = glcr::MakeShared<Message>();
|
||||||
msg->bytes = new uint8_t[8];
|
msg->message = glcr::Array<uint8_t>(sizeof(init));
|
||||||
msg->num_bytes = sizeof(init);
|
|
||||||
|
|
||||||
uint8_t* data = reinterpret_cast<uint8_t*>(&init);
|
uint8_t* data = reinterpret_cast<uint8_t*>(&init);
|
||||||
for (uint8_t i = 0; i < sizeof(init); i++) {
|
for (uint8_t i = 0; i < sizeof(init); i++) {
|
||||||
msg->bytes[i] = data[i];
|
msg->message[i] = data[i];
|
||||||
}
|
}
|
||||||
msg->caps.PushBack(cap);
|
msg->caps.PushBack(cap);
|
||||||
|
|
||||||
pending_messages_.PushBack(msg);
|
pending_messages_.PushBack(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
glcr::ErrorCode SingleMessageQueue::PushBack(uint64_t num_bytes,
|
glcr::ErrorCode SingleMessageQueue::PushBack(
|
||||||
const void* bytes,
|
const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps,
|
const glcr::ArrayView<z_cap_t>& caps, z_cap_t reply_port) {
|
||||||
const z_cap_t* caps,
|
|
||||||
z_cap_t reply_port) {
|
|
||||||
MutexHolder h(mutex_);
|
MutexHolder h(mutex_);
|
||||||
if (has_written_) {
|
if (has_written_) {
|
||||||
return glcr::FAILED_PRECONDITION;
|
return glcr::FAILED_PRECONDITION;
|
||||||
}
|
}
|
||||||
num_bytes_ = num_bytes;
|
message_ = message;
|
||||||
bytes_ = new uint8_t[num_bytes];
|
|
||||||
|
|
||||||
for (uint64_t i = 0; i < num_bytes; i++) {
|
|
||||||
bytes_[i] = reinterpret_cast<const uint8_t*>(bytes)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reply_port != kZionInvalidCapability) {
|
if (reply_port != kZionInvalidCapability) {
|
||||||
dbgln("Sent a reply port to a single message queue");
|
dbgln("Sent a reply port to a single message queue");
|
||||||
return glcr::INTERNAL;
|
return glcr::INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint64_t i = 0; i < num_caps; i++) {
|
for (uint64_t i = 0; i < caps.size(); i++) {
|
||||||
// FIXME: This would feel safer closer to the relevant syscall.
|
// FIXME: This would feel safer closer to the relevant syscall.
|
||||||
auto cap = gScheduler->CurrentProcess().GetCapability(caps[i]);
|
auto cap = gScheduler->CurrentProcess().GetCapability(caps[i]);
|
||||||
if (!cap) {
|
if (!cap) {
|
||||||
|
@ -181,16 +167,16 @@ glcr::ErrorCode SingleMessageQueue::PopFront(uint64_t* num_bytes, void* bytes,
|
||||||
return glcr::FAILED_PRECONDITION;
|
return glcr::FAILED_PRECONDITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_bytes_ > *num_bytes) {
|
if (message_.size() > *num_bytes) {
|
||||||
return glcr::BUFFER_SIZE;
|
return glcr::BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
if (caps_.size() > *num_caps) {
|
if (caps_.size() > *num_caps) {
|
||||||
return glcr::BUFFER_SIZE;
|
return glcr::BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*num_bytes = num_bytes_;
|
*num_bytes = message_.size();
|
||||||
for (uint64_t i = 0; i < num_bytes_; i++) {
|
for (uint64_t i = 0; i < message_.size(); i++) {
|
||||||
reinterpret_cast<uint8_t*>(bytes)[i] = bytes_[i];
|
reinterpret_cast<uint8_t*>(bytes)[i] = message_[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply_port != nullptr) {
|
if (reply_port != nullptr) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <glacier/container/array.h>
|
||||||
|
#include <glacier/container/array_view.h>
|
||||||
#include <glacier/container/intrusive_list.h>
|
#include <glacier/container/intrusive_list.h>
|
||||||
#include <glacier/container/linked_list.h>
|
#include <glacier/container/linked_list.h>
|
||||||
#include <glacier/memory/ref_ptr.h>
|
#include <glacier/memory/ref_ptr.h>
|
||||||
|
@ -14,12 +16,12 @@ class MessageQueue {
|
||||||
public:
|
public:
|
||||||
virtual ~MessageQueue() {}
|
virtual ~MessageQueue() {}
|
||||||
|
|
||||||
virtual glcr::ErrorCode PushBack(uint64_t num_bytes, const void* bytes,
|
virtual glcr::ErrorCode PushBack(const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps, const z_cap_t* caps,
|
const glcr::ArrayView<z_cap_t>& caps,
|
||||||
z_cap_t reply_cap = 0) = 0;
|
z_cap_t reply_cap) = 0;
|
||||||
virtual glcr::ErrorCode PopFront(uint64_t* num_bytes, void* bytes,
|
virtual glcr::ErrorCode PopFront(uint64_t* num_bytes, void* bytes,
|
||||||
uint64_t* num_caps, z_cap_t* caps,
|
uint64_t* num_caps, z_cap_t* caps,
|
||||||
z_cap_t* reply_cap = nullptr) = 0;
|
z_cap_t* reply_cap) = 0;
|
||||||
virtual bool empty() = 0;
|
virtual bool empty() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -36,8 +38,8 @@ class UnboundedMessageQueue : public MessageQueue {
|
||||||
UnboundedMessageQueue& operator=(const UnboundedMessageQueue&) = delete;
|
UnboundedMessageQueue& operator=(const UnboundedMessageQueue&) = delete;
|
||||||
virtual ~UnboundedMessageQueue() override {}
|
virtual ~UnboundedMessageQueue() override {}
|
||||||
|
|
||||||
glcr::ErrorCode PushBack(uint64_t num_bytes, const void* bytes,
|
glcr::ErrorCode PushBack(const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps, const z_cap_t* caps,
|
const glcr::ArrayView<z_cap_t>& caps,
|
||||||
z_cap_t reply_cap) override;
|
z_cap_t reply_cap) override;
|
||||||
glcr::ErrorCode PopFront(uint64_t* num_bytes, void* bytes, uint64_t* num_caps,
|
glcr::ErrorCode PopFront(uint64_t* num_bytes, void* bytes, uint64_t* num_caps,
|
||||||
z_cap_t* caps, z_cap_t* reply_cap) override;
|
z_cap_t* caps, z_cap_t* reply_cap) override;
|
||||||
|
@ -51,8 +53,7 @@ class UnboundedMessageQueue : public MessageQueue {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Message {
|
struct Message {
|
||||||
uint64_t num_bytes;
|
glcr::Array<uint8_t> message;
|
||||||
uint8_t* bytes;
|
|
||||||
|
|
||||||
glcr::LinkedList<glcr::RefPtr<Capability>> caps;
|
glcr::LinkedList<glcr::RefPtr<Capability>> caps;
|
||||||
glcr::RefPtr<Capability> reply_cap;
|
glcr::RefPtr<Capability> reply_cap;
|
||||||
|
@ -68,8 +69,8 @@ class SingleMessageQueue : public MessageQueue {
|
||||||
SingleMessageQueue(SingleMessageQueue&&) = delete;
|
SingleMessageQueue(SingleMessageQueue&&) = delete;
|
||||||
virtual ~SingleMessageQueue() override {}
|
virtual ~SingleMessageQueue() override {}
|
||||||
|
|
||||||
glcr::ErrorCode PushBack(uint64_t num_bytes, const void* bytes,
|
glcr::ErrorCode PushBack(const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps, const z_cap_t* caps,
|
const glcr::ArrayView<z_cap_t>& caps,
|
||||||
z_cap_t reply_cap) override;
|
z_cap_t reply_cap) override;
|
||||||
glcr::ErrorCode PopFront(uint64_t* num_bytes, void* bytes, uint64_t* num_caps,
|
glcr::ErrorCode PopFront(uint64_t* num_bytes, void* bytes, uint64_t* num_caps,
|
||||||
z_cap_t* caps, z_cap_t* reply_cap) override;
|
z_cap_t* caps, z_cap_t* reply_cap) override;
|
||||||
|
@ -82,7 +83,6 @@ class SingleMessageQueue : public MessageQueue {
|
||||||
private:
|
private:
|
||||||
bool has_written_ = false;
|
bool has_written_ = false;
|
||||||
bool has_read_ = false;
|
bool has_read_ = false;
|
||||||
uint64_t num_bytes_;
|
glcr::Array<uint8_t> message_;
|
||||||
uint8_t* bytes_;
|
|
||||||
glcr::LinkedList<glcr::RefPtr<Capability>> caps_;
|
glcr::LinkedList<glcr::RefPtr<Capability>> caps_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,18 +5,3 @@
|
||||||
glcr::RefPtr<Endpoint> Endpoint::Create() {
|
glcr::RefPtr<Endpoint> Endpoint::Create() {
|
||||||
return glcr::AdoptPtr(new Endpoint);
|
return glcr::AdoptPtr(new Endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
glcr::ErrorCode Endpoint::Send(uint64_t num_bytes, const void* data,
|
|
||||||
uint64_t num_caps, const z_cap_t* caps,
|
|
||||||
z_cap_t reply_port_cap) {
|
|
||||||
auto& message_queue = GetSendMessageQueue();
|
|
||||||
return message_queue.PushBack(num_bytes, data, num_caps, caps,
|
|
||||||
reply_port_cap);
|
|
||||||
}
|
|
||||||
glcr::ErrorCode Endpoint::Recv(uint64_t* num_bytes, void* data,
|
|
||||||
uint64_t* num_caps, z_cap_t* caps,
|
|
||||||
z_cap_t* reply_port_cap) {
|
|
||||||
auto& message_queue = GetRecvMessageQueue();
|
|
||||||
return message_queue.PopFront(num_bytes, data, num_caps, caps,
|
|
||||||
reply_port_cap);
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,12 +26,6 @@ class Endpoint : public IpcObject {
|
||||||
|
|
||||||
static glcr::RefPtr<Endpoint> Create();
|
static glcr::RefPtr<Endpoint> Create();
|
||||||
|
|
||||||
// FIXME: These are hacky "almost" overrides that could lead to bugs.
|
|
||||||
glcr::ErrorCode Send(uint64_t num_bytes, const void* data, uint64_t num_caps,
|
|
||||||
const z_cap_t* caps, z_cap_t reply_port_cap);
|
|
||||||
glcr::ErrorCode Recv(uint64_t* num_bytes, void* data, uint64_t* num_caps,
|
|
||||||
z_cap_t* caps, z_cap_t* reply_port_cap);
|
|
||||||
|
|
||||||
virtual MessageQueue& GetSendMessageQueue() override {
|
virtual MessageQueue& GetSendMessageQueue() override {
|
||||||
return message_queue_;
|
return message_queue_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,26 @@
|
||||||
|
|
||||||
#include "scheduler/scheduler.h"
|
#include "scheduler/scheduler.h"
|
||||||
|
|
||||||
glcr::ErrorCode IpcObject::Send(uint64_t num_bytes, const void* bytes,
|
glcr::ErrorCode IpcObject::Send(const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps, const z_cap_t* caps) {
|
const glcr::ArrayView<z_cap_t>& caps) {
|
||||||
|
return Send(message, caps, kZionInvalidCapability);
|
||||||
|
}
|
||||||
|
|
||||||
|
glcr::ErrorCode IpcObject::Send(const glcr::ArrayView<uint8_t>& message,
|
||||||
|
const glcr::ArrayView<z_cap_t>& caps,
|
||||||
|
const z_cap_t reply_port) {
|
||||||
auto& message_queue = GetSendMessageQueue();
|
auto& message_queue = GetSendMessageQueue();
|
||||||
return message_queue.PushBack(num_bytes, bytes, num_caps, caps);
|
return message_queue.PushBack(message, caps, reply_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
glcr::ErrorCode IpcObject::Recv(uint64_t* num_bytes, void* bytes,
|
glcr::ErrorCode IpcObject::Recv(uint64_t* num_bytes, void* bytes,
|
||||||
uint64_t* num_caps, z_cap_t* caps) {
|
uint64_t* num_caps, z_cap_t* caps) {
|
||||||
auto& message_queue = GetRecvMessageQueue();
|
return Recv(num_bytes, bytes, num_caps, caps, nullptr);
|
||||||
return message_queue.PopFront(num_bytes, bytes, num_caps, caps);
|
}
|
||||||
|
|
||||||
|
glcr::ErrorCode IpcObject::Recv(uint64_t* num_bytes, void* bytes,
|
||||||
|
uint64_t* num_caps, z_cap_t* caps,
|
||||||
|
z_cap_t* reply_port) {
|
||||||
|
auto& message_queue = GetRecvMessageQueue();
|
||||||
|
return message_queue.PopFront(num_bytes, bytes, num_caps, caps, reply_port);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,17 @@ class IpcObject : public KernelObject {
|
||||||
IpcObject(){};
|
IpcObject(){};
|
||||||
virtual ~IpcObject() {}
|
virtual ~IpcObject() {}
|
||||||
|
|
||||||
virtual glcr::ErrorCode Send(uint64_t num_bytes, const void* bytes,
|
virtual glcr::ErrorCode Send(const glcr::ArrayView<uint8_t>& message,
|
||||||
uint64_t num_caps, const z_cap_t* caps) final;
|
const glcr::ArrayView<z_cap_t>& caps) final;
|
||||||
|
virtual glcr::ErrorCode Send(const glcr::ArrayView<uint8_t>& message,
|
||||||
|
const glcr::ArrayView<z_cap_t>& caps,
|
||||||
|
const z_cap_t reply_port) final;
|
||||||
|
|
||||||
virtual glcr::ErrorCode Recv(uint64_t* num_bytes, void* bytes,
|
virtual glcr::ErrorCode Recv(uint64_t* num_bytes, void* bytes,
|
||||||
uint64_t* num_caps, z_cap_t* caps) final;
|
uint64_t* num_caps, z_cap_t* caps) final;
|
||||||
|
virtual glcr::ErrorCode Recv(uint64_t* num_bytes, void* bytes,
|
||||||
|
uint64_t* num_caps, z_cap_t* caps,
|
||||||
|
z_cap_t* reply_port) final;
|
||||||
|
|
||||||
bool HasMessages() { return !GetRecvMessageQueue().empty(); }
|
bool HasMessages() { return !GetRecvMessageQueue().empty(); }
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,14 @@
|
||||||
#include "object/reply_port.h"
|
#include "object/reply_port.h"
|
||||||
#include "scheduler/scheduler.h"
|
#include "scheduler/scheduler.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
glcr::ArrayView<uint8_t> Buffer(const void* bytes, uint64_t num_bytes) {
|
||||||
|
return glcr::ArrayView(reinterpret_cast<uint8_t*>(const_cast<void*>(bytes)),
|
||||||
|
num_bytes);
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
glcr::ErrorCode ChannelCreate(ZChannelCreateReq* req) {
|
glcr::ErrorCode ChannelCreate(ZChannelCreateReq* req) {
|
||||||
auto& proc = gScheduler->CurrentProcess();
|
auto& proc = gScheduler->CurrentProcess();
|
||||||
auto chan_pair = Channel::CreateChannelPair();
|
auto chan_pair = Channel::CreateChannelPair();
|
||||||
|
@ -20,7 +28,8 @@ glcr::ErrorCode ChannelSend(ZChannelSendReq* req) {
|
||||||
RET_ERR(ValidateCapability<Channel>(chan_cap, kZionPerm_Write));
|
RET_ERR(ValidateCapability<Channel>(chan_cap, kZionPerm_Write));
|
||||||
|
|
||||||
auto chan = chan_cap->obj<Channel>();
|
auto chan = chan_cap->obj<Channel>();
|
||||||
return chan->Send(req->num_bytes, req->data, req->num_caps, req->caps);
|
return chan->Send(Buffer(req->data, req->num_bytes),
|
||||||
|
glcr::ArrayView<z_cap_t>(req->caps, req->num_caps));
|
||||||
}
|
}
|
||||||
|
|
||||||
glcr::ErrorCode ChannelRecv(ZChannelRecvReq* req) {
|
glcr::ErrorCode ChannelRecv(ZChannelRecvReq* req) {
|
||||||
|
@ -45,7 +54,8 @@ glcr::ErrorCode PortSend(ZPortSendReq* req) {
|
||||||
RET_ERR(ValidateCapability<Port>(port_cap, kZionPerm_Write));
|
RET_ERR(ValidateCapability<Port>(port_cap, kZionPerm_Write));
|
||||||
|
|
||||||
auto port = port_cap->obj<Port>();
|
auto port = port_cap->obj<Port>();
|
||||||
return port->Send(req->num_bytes, req->data, req->num_caps, req->caps);
|
return port->Send(Buffer(req->data, req->num_bytes),
|
||||||
|
glcr::ArrayView<z_cap_t>(req->caps, req->num_caps));
|
||||||
}
|
}
|
||||||
|
|
||||||
glcr::ErrorCode PortRecv(ZPortRecvReq* req) {
|
glcr::ErrorCode PortRecv(ZPortRecvReq* req) {
|
||||||
|
@ -100,7 +110,9 @@ glcr::ErrorCode EndpointSend(ZEndpointSendReq* req) {
|
||||||
*req->reply_port_cap = proc.AddNewCapability(reply_port, kZionPerm_Read);
|
*req->reply_port_cap = proc.AddNewCapability(reply_port, kZionPerm_Read);
|
||||||
uint64_t reply_port_cap_to_send =
|
uint64_t reply_port_cap_to_send =
|
||||||
proc.AddNewCapability(reply_port, kZionPerm_Write | kZionPerm_Transmit);
|
proc.AddNewCapability(reply_port, kZionPerm_Write | kZionPerm_Transmit);
|
||||||
return endpoint->Send(req->num_bytes, req->data, req->num_caps, req->caps,
|
return endpoint->Send(
|
||||||
|
Buffer(req->data, req->num_bytes),
|
||||||
|
glcr::ArrayView<z_cap_t>(const_cast<z_cap_t*>(req->caps), req->num_caps),
|
||||||
reply_port_cap_to_send);
|
reply_port_cap_to_send);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +138,8 @@ glcr::ErrorCode ReplyPortSend(ZReplyPortSendReq* req) {
|
||||||
ValidateCapability<ReplyPort>(reply_port_cap, kZionPerm_Read);
|
ValidateCapability<ReplyPort>(reply_port_cap, kZionPerm_Read);
|
||||||
auto reply_port = reply_port_cap->obj<ReplyPort>();
|
auto reply_port = reply_port_cap->obj<ReplyPort>();
|
||||||
|
|
||||||
return reply_port->Send(req->num_bytes, req->data, req->num_caps, req->caps);
|
return reply_port->Send(Buffer(req->data, req->num_bytes),
|
||||||
|
glcr::ArrayView<z_cap_t>(req->caps, req->num_caps));
|
||||||
}
|
}
|
||||||
glcr::ErrorCode ReplyPortRecv(ZReplyPortRecvReq* req) {
|
glcr::ErrorCode ReplyPortRecv(ZReplyPortRecvReq* req) {
|
||||||
auto& proc = gScheduler->CurrentProcess();
|
auto& proc = gScheduler->CurrentProcess();
|
||||||
|
|
Loading…
Reference in New Issue