Skip to content

Commit

Permalink
fix: merge stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Böving committed Nov 14, 2023
1 parent 9c1730f commit cfdb29a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/l4/pkg/l4rust/l4-rust/ipc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use num_traits::FromPrimitive;

use crate::error::{Error, Result};
use crate::types::{Mword, Protocol, UMword};
use crate::utcb::Utcb;

use l4_sys;

Expand Down
7 changes: 7 additions & 0 deletions src/l4/pkg/l4rust/l4re-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ path = "../l4-rust"
# ToDo: make this conditional
default-features = false

[dependencies.l4_sys]
path = "../l4-sys-rust"

[dependencies.l4_derive]
path = "../l4_derive-rust"

[dependencies.bitflags]
version = "1.0"
default-features = false
7 changes: 4 additions & 3 deletions src/l4/pkg/l4rust/l4re-rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
//! L4Re interface crate
//!
//! Reimplemented methods
//#![no_std]
#![no_std]
#![feature(associated_type_defaults)]

extern crate core as _core;
extern crate l4;
extern crate l4_derive;
extern crate l4_sys;
extern crate libc;

mod cap;
pub mod env;
pub mod mem;
pub mod sys;
pub mod factory;
pub mod io;
pub mod factory;

pub use cap::OwnedCap;
7 changes: 3 additions & 4 deletions src/l4/pkg/l4rust/l4re-rust/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use l4::Error;
use l4::Result;
use l4::cap::CapIdx;
use l4::cap::Interface;
use l4::cap::Cap;
use l4::task::THIS_TASK;
use l4::ipc::MsgTag;
use bitflags::bitflags;
Expand All @@ -22,6 +21,8 @@ use crate::sys::l4re_ma_flags::*;
use crate::sys::l4re_rm_flags_values::*;
use crate::sys::l4re_rm_attach;
use crate::sys::l4re_rm_detach;
use crate::sys::L4_fpage_rights::L4_FPAGE_RWX;
use crate::sys::l4_msg_item_consts_t::L4_MAP_ITEM_MAP;
use l4_sys::l4re_util_cap_alloc;
use l4_sys::l4_error_code_t::L4_EOK;
use l4_sys::{L4_PAGESHIFT, L4_SUPERPAGESHIFT};
Expand Down Expand Up @@ -192,19 +193,17 @@ impl AttachedDataspace {
let mut addr = self.ptr as usize; // source address;
let page_size = 1 << self.cap.pageshift;
assert!((addr | len) % page_size == 0);
println!("Starting to map dataspace from 0x{:x} to 0x{:x}, length: 0x{:x}, alignment: 0x{:x}", addr, addr, len, page_size);

while len != 0 {
let o = maxorder(addr, len, self.cap.pageshift);
let sz = 1 << o;

let fp = unsafe { l4_fpage_w(addr, o as u32, L4_FPAGE_RWX as u8) };
let ctl = l4_map_obj_control(addr as u64, L4_MAP_ITEM_MAP as u64);
let ctl = l4_map_obj_control(addr as u64, L4_MAP_ITEM_MAP as u32);
let tag : MsgTag = unsafe { l4_task_map(target.raw(), THIS_TASK.raw(), fp, ctl as usize) }.into();
tag.result()?;

len -= sz;
println!("Mapped from 0x{:x} to 0x{:x}, length: 0x{:x}, remaining: 0x{:x}", addr, addr, sz, len);
addr += sz;
}

Expand Down
3 changes: 3 additions & 0 deletions src/l4/pkg/verix/pc-hal-l4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ edition = "2021"

[dependencies]
pc-hal = { path = "../pc-hal" }
l4_sys = { path = "../../l4rust/l4-sys-rust/" }
l4re = { path = "../../l4rust/l4re-rust/" }
l4 = { path = "../../l4rust/l4-rust/" }
4 changes: 0 additions & 4 deletions src/l4/pkg/verix/pc-hal-l4/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate l4;
extern crate l4_sys;
extern crate l4re;

use l4::cap::Cap;
use l4re::env::get_cap;
use l4re::factory::{Factory, FactoryCreate, IrqSender};
Expand Down

0 comments on commit cfdb29a

Please sign in to comment.