[Yellowstone] Spawn VFS and handle GetEndpoint.

This commit is contained in:
Drew Galbraith 2024-08-17 22:05:52 -07:00
parent e90018b42e
commit 090441ad04
2 changed files with 26 additions and 2 deletions

View File

@ -46,9 +46,17 @@ extern "C" fn main() -> z_err_t {
.expect("Failed to spawn denali");
context.wait_denali().expect("Failed to wait for denali");
mammoth::debug!("Denali registered.");
spawn_from_vmmo(
unsafe { mammoth::init::BOOT_VICTORIA_FALLS_VMMO },
server.create_client_cap().unwrap(),
)
.expect("Failed to spawn victoriafalls");
context.wait_victoria_falls().unwrap();
mammoth::debug!("VFS Registered");
server_thread.join().expect("Failed to join thread");
0
}

View File

@ -10,6 +10,7 @@ use crate::pci::PciReader;
pub struct YellowstoneServerContext {
denali_semaphore: mammoth::sync::Semaphore,
victoria_falls_semaphore: mammoth::sync::Semaphore,
pci_reader: PciReader,
}
@ -17,6 +18,7 @@ impl YellowstoneServerContext {
pub fn new(pci_region: MemoryRegion) -> Result<Self, ZError> {
Ok(Self {
denali_semaphore: mammoth::sync::Semaphore::new()?,
victoria_falls_semaphore: mammoth::sync::Semaphore::new()?,
pci_reader: PciReader::new(pci_region),
})
}
@ -24,6 +26,10 @@ impl YellowstoneServerContext {
pub fn wait_denali(&self) -> Result<(), ZError> {
self.denali_semaphore.wait()
}
pub fn wait_victoria_falls(&self) -> Result<(), ZError> {
self.victoria_falls_semaphore.wait()
}
}
pub struct YellowstoneServerImpl {
@ -43,17 +49,27 @@ impl YellowstoneServerImpl {
impl YellowstoneServerHandler for YellowstoneServerImpl {
fn register_endpoint(&mut self, req: RegisterEndpointRequest) -> Result<(), ZError> {
let signal_denali = req.endpoint_name == "denali";
let signal_vfs = req.endpoint_name == "victoriafalls";
self.service_map
.insert(req.endpoint_name, Capability::take(req.endpoint_capability));
if signal_denali {
self.context.denali_semaphore.signal()?
}
if signal_vfs {
self.context.victoria_falls_semaphore.signal()?
}
Ok(())
}
fn get_endpoint(&mut self, req: GetEndpointRequest) -> Result<Endpoint, ZError> {
todo!()
match self.service_map.get(&req.endpoint_name) {
Some(cap) => Ok(Endpoint {
endpoint: cap.duplicate(Capability::PERMS_ALL)?.release(),
}),
None => Err(ZError::NOT_FOUND),
}
}
fn get_ahci_info(&mut self) -> Result<AhciInfo, ZError> {