[Yellowstone] Allow registering denali.
This commit is contained in:
parent
c9b484089e
commit
e90018b42e
7 changed files with 195 additions and 26 deletions
|
|
@ -78,6 +78,10 @@ impl MemoryRegion {
|
|||
pub fn cap(&self) -> &Capability {
|
||||
&self.mem_cap
|
||||
}
|
||||
|
||||
pub fn duplicate(&self, offset: u64, length: u64) -> Result<Capability, ZError> {
|
||||
syscall::memory_obj_duplicate(&self.mem_cap, offset, length)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for MemoryRegion {
|
||||
|
|
|
|||
|
|
@ -167,6 +167,24 @@ pub fn memory_object_inspect(mem_cap: &Capability) -> Result<u64, ZError> {
|
|||
Ok(mem_size)
|
||||
}
|
||||
|
||||
pub fn memory_obj_duplicate(
|
||||
mem_cap: &Capability,
|
||||
base_offset: u64,
|
||||
length: u64,
|
||||
) -> Result<Capability, ZError> {
|
||||
let mut new_cap = 0;
|
||||
syscall(
|
||||
zion::kZionMemoryObjectDuplicate,
|
||||
&zion::ZMemoryObjectDuplicateReq {
|
||||
vmmo_cap: mem_cap.raw(),
|
||||
base_offset,
|
||||
length,
|
||||
new_vmmo_cap: &mut new_cap,
|
||||
},
|
||||
)?;
|
||||
Ok(Capability::take(new_cap))
|
||||
}
|
||||
|
||||
pub fn address_space_map(vmmo_cap: &Capability) -> Result<u64, ZError> {
|
||||
let mut vaddr: u64 = 0;
|
||||
// FIXME: Allow caller to pass these options.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use mammoth::zion::z_cap_t;
|
|||
use mammoth::zion::ZError;
|
||||
|
||||
pub trait YunqServer {
|
||||
fn server_loop(&self) {
|
||||
fn server_loop(&mut self) {
|
||||
loop {
|
||||
let mut byte_buffer = ByteBuffer::<1024>::new();
|
||||
let mut cap_buffer = vec![0; 10];
|
||||
|
|
@ -44,7 +44,7 @@ pub trait YunqServer {
|
|||
.duplicate(!mammoth::zion::kZionPerm_Read)
|
||||
}
|
||||
fn handle_request(
|
||||
&self,
|
||||
&mut self,
|
||||
method_number: u64,
|
||||
byte_buffer: &mut ByteBuffer<1024>,
|
||||
cap_buffer: &mut Vec<z_cap_t>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue