Endpoint syscalls implemented

This commit is contained in:
Drew Galbraith 2023-06-21 23:14:42 -07:00
parent 69501bfe01
commit c064af5fa7
27 changed files with 391 additions and 42 deletions

View file

@ -7,8 +7,11 @@
Command::~Command() {}
DmaReadCommand::DmaReadCommand(uint64_t lba, uint64_t sector_cnt,
DmaCallback callback)
: lba_(lba), sector_cnt_(sector_cnt), callback_(callback) {
DmaCallback callback, z_cap_t reply_port)
: reply_port_(reply_port),
lba_(lba),
sector_cnt_(sector_cnt),
callback_(callback) {
region_ = MappedMemoryRegion::ContiguousPhysical(sector_cnt * 512);
}
@ -46,4 +49,6 @@ void DmaReadCommand::PopulatePrdt(PhysicalRegionDescriptor* prdt) {
prdt[0].region_address = region_.paddr();
prdt[0].byte_count = region_.size();
}
void DmaReadCommand::Callback() { callback_(lba_, sector_cnt_, region_.cap()); }
void DmaReadCommand::Callback() {
callback_(reply_port_, lba_, sector_cnt_, region_.cap());
}

View file

@ -15,8 +15,9 @@ class Command {
class DmaReadCommand : public Command {
public:
typedef void (*DmaCallback)(uint64_t, uint64_t, uint64_t);
DmaReadCommand(uint64_t lba, uint64_t sector_cnt, DmaCallback callback);
typedef void (*DmaCallback)(z_cap_t, uint64_t, uint64_t, z_cap_t);
DmaReadCommand(uint64_t lba, uint64_t sector_cnt, DmaCallback callback,
z_cap_t reply_port);
virtual ~DmaReadCommand() override;
@ -26,6 +27,7 @@ class DmaReadCommand : public Command {
void Callback() override;
private:
z_cap_t reply_port_;
uint64_t lba_;
uint64_t sector_cnt_;
DmaCallback callback_;