[Yellowstone] Wireframe for moving yellowstone to rust.
This commit is contained in:
parent
0aa4a1f5f1
commit
c9b484089e
24 changed files with 265 additions and 25 deletions
|
|
@ -7,4 +7,4 @@ edition = "2021"
|
|||
mammoth = { path = "../../lib/mammoth" }
|
||||
victoriafalls = { path = "../../lib/victoriafalls" }
|
||||
voyageurs = { path = "../../lib/voyageurs" }
|
||||
yellowstone = { path = "../../lib/yellowstone" }
|
||||
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use mammoth::{mem::MemoryRegion, zion::ZError};
|
||||
use yellowstone::FramebufferInfo;
|
||||
use yellowstone_yunq::FramebufferInfo;
|
||||
|
||||
pub struct Framebuffer {
|
||||
fb_info: FramebufferInfo,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ define_entry!();
|
|||
extern "C" fn main() -> z_err_t {
|
||||
debug!("Teton Starting");
|
||||
|
||||
let yellowstone = yellowstone::from_init_endpoint();
|
||||
let yellowstone = yellowstone_yunq::from_init_endpoint();
|
||||
let framebuffer_info = yellowstone
|
||||
.get_framebuffer_info()
|
||||
.expect("Failed to get framebuffer info.");
|
||||
|
|
|
|||
12
rust/sys/yellowstone/Cargo.toml
Normal file
12
rust/sys/yellowstone/Cargo.toml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[package]
|
||||
name = "yellowstone"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
mammoth = { path = "../../lib/mammoth" }
|
||||
denali = { path = "../../lib/denali" }
|
||||
victoriafalls = { path = "../../lib/victoriafalls" }
|
||||
voyageurs = { path = "../../lib/voyageurs" }
|
||||
yellowstone-yunq = { path = "../../lib/yellowstone" }
|
||||
yunq = { path = "../../lib/yunq" }
|
||||
48
rust/sys/yellowstone/src/main.rs
Normal file
48
rust/sys/yellowstone/src/main.rs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use mammoth::{
|
||||
cap::Capability,
|
||||
define_entry, elf,
|
||||
zion::{kZionPerm_Read, z_cap_t, z_err_t, ZError},
|
||||
};
|
||||
use yellowstone_yunq::YellowstoneServer;
|
||||
use yunq::server::YunqServer;
|
||||
|
||||
mod server;
|
||||
|
||||
define_entry!();
|
||||
|
||||
fn spawn_from_vmmo(vmmo_cap: z_cap_t, server_cap: Capability) -> Result<(), ZError> {
|
||||
let region = mammoth::mem::MemoryRegion::from_cap(Capability::take(vmmo_cap))?;
|
||||
elf::spawn_process_from_elf_and_init(region.slice(), server_cap)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
extern "C" fn main() -> z_err_t {
|
||||
let context = alloc::rc::Rc::new(
|
||||
server::YellowstoneServerContext::new().expect("Failed to create yellowstone context"),
|
||||
);
|
||||
let handler = server::YellowstoneServerImpl::new(context.clone());
|
||||
let server = YellowstoneServer::new(handler).expect("Couldn't create yellowstone server");
|
||||
|
||||
let server_thread = server.run_server().expect("Failed to run server");
|
||||
|
||||
spawn_from_vmmo(
|
||||
unsafe { mammoth::init::BOOT_DENALI_VMMO },
|
||||
server
|
||||
.create_client_cap()
|
||||
.expect("Failed to create client cap for denali"),
|
||||
)
|
||||
.expect("Failed to spawn denali");
|
||||
|
||||
context.wait_denali().expect("Failed to wait for denali");
|
||||
|
||||
mammoth::debug!("Denali registered.");
|
||||
|
||||
server_thread.join().expect("Failed to join thread");
|
||||
0
|
||||
}
|
||||
58
rust/sys/yellowstone/src/server.rs
Normal file
58
rust/sys/yellowstone/src/server.rs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
use alloc::rc::Rc;
|
||||
use mammoth::zion::ZError;
|
||||
use yellowstone_yunq::{
|
||||
AhciInfo, DenaliInfo, Endpoint, FramebufferInfo, GetEndpointRequest, RegisterEndpointRequest,
|
||||
XhciInfo, YellowstoneServerHandler,
|
||||
};
|
||||
|
||||
pub struct YellowstoneServerContext {
|
||||
denali_semaphore: mammoth::sync::Semaphore,
|
||||
}
|
||||
|
||||
impl YellowstoneServerContext {
|
||||
pub fn new() -> Result<Self, ZError> {
|
||||
Ok(Self {
|
||||
denali_semaphore: mammoth::sync::Semaphore::new()?,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn wait_denali(&self) -> Result<(), ZError> {
|
||||
self.denali_semaphore.wait()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct YellowstoneServerImpl {
|
||||
context: Rc<YellowstoneServerContext>,
|
||||
}
|
||||
|
||||
impl YellowstoneServerImpl {
|
||||
pub fn new(context: Rc<YellowstoneServerContext>) -> Self {
|
||||
Self { context }
|
||||
}
|
||||
}
|
||||
|
||||
impl YellowstoneServerHandler for YellowstoneServerImpl {
|
||||
fn register_endpoint(&self, req: &RegisterEndpointRequest) -> Result<(), ZError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_endpoint(&self, req: &GetEndpointRequest) -> Result<Endpoint, ZError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_ahci_info(&self) -> Result<AhciInfo, ZError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_xhci_info(&self) -> Result<XhciInfo, ZError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_framebuffer_info(&self) -> Result<FramebufferInfo, ZError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_denali(&self) -> Result<DenaliInfo, ZError> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue