[Yellowstone] Attempt to read a test file from the system root.

This commit is contained in:
Drew Galbraith 2023-11-02 19:28:27 -07:00
parent 38fb6ca170
commit b6c220a350
5 changed files with 25 additions and 0 deletions

View File

@ -12,6 +12,7 @@ target_link_libraries(yellowstone
denali_yunq
mammoth
glacier
victoriafalls_yunq
yellowstone_yunq
)

View File

@ -1,6 +1,7 @@
#include <mammoth/debug.h>
#include <mammoth/endpoint_client.h>
#include <mammoth/init.h>
#include <mammoth/memory_region.h>
#include <mammoth/process.h>
#include <zcall.h>
@ -33,6 +34,17 @@ uint64_t main(uint64_t port_cap) {
dbgln("VFS Available.");
auto vfs_client = server->GetVFSClient();
OpenFileRequest request;
request.set_path("/init.txt");
OpenFileResponse response;
check(vfs_client->OpenFile(request, response));
MappedMemoryRegion file =
MappedMemoryRegion::FromCapability(response.memory());
dbgln("addr: %lu, size: %lu", file.vaddr(), file.size());
check(server_thread.Join());
dbgln("Yellowstone Finished Successfully.");
return 0;

View File

@ -85,6 +85,9 @@ glcr::ErrorCode YellowstoneServer::HandleRegisterEndpoint(
check(has_denali_mutex_.Release());
} else if (req.endpoint_name() == "victoriafalls") {
victoria_falls_cap_ = req.endpoint_capability();
// FIXME: Probably make a separate copy for use within yellowstone vs
// transmit to other processes.
vfs_client_ = glcr::MakeShared<VFSClient>(victoria_falls_cap_);
check(has_victoriafalls_mutex_.Release());
} else {
dbgln("[WARN] Got endpoint cap type: %s", req.endpoint_name().cstr());
@ -101,3 +104,7 @@ glcr::ErrorCode YellowstoneServer::WaitVictoriaFallsRegistered() {
RET_ERR(has_victoriafalls_mutex_.Lock());
return has_victoriafalls_mutex_.Release();
}
glcr::SharedPtr<VFSClient> YellowstoneServer::GetVFSClient() {
return vfs_client_;
}

View File

@ -1,11 +1,13 @@
#pragma once
#include <glacier/memory/shared_ptr.h>
#include <glacier/memory/unique_ptr.h>
#include <glacier/status/error_or.h>
#include <mammoth/endpoint_server.h>
#include <mammoth/mutex.h>
#include <mammoth/port_server.h>
#include <mammoth/thread.h>
#include <victoriafalls/victoriafalls.yunq.client.h>
#include "hw/pcie.h"
#include "lib/yellowstone/yellowstone.yunq.server.h"
@ -22,12 +24,15 @@ class YellowstoneServer : public YellowstoneServerBase {
glcr::ErrorCode WaitDenaliRegistered();
glcr::ErrorCode WaitVictoriaFallsRegistered();
glcr::SharedPtr<VFSClient> GetVFSClient();
private:
// TODO: Store these in a data structure.
z_cap_t denali_cap_ = 0;
uint64_t device_id_ = 0;
uint64_t lba_offset_ = 0;
z_cap_t victoria_falls_cap_ = 0;
glcr::SharedPtr<VFSClient> vfs_client_;
PciReader pci_reader_;