-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add arch relevant invocation and add doc
- Loading branch information
Showing
5 changed files
with
125 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use sel4_common::{arch::{vm_rights_t, ObjectType}, sel4_config::{asidInvalid, ARM_Large_Page, ARM_Small_Page}}; | ||
use sel4_cspace::arch::cap_t; | ||
use sel4_vspace::pptr_t; | ||
|
||
pub fn arch_create_object( | ||
obj_type: ObjectType, | ||
region_base: pptr_t, | ||
user_size: usize, | ||
device_mem: usize, | ||
) -> cap_t { | ||
match obj_type { | ||
ObjectType::seL4_ARM_SmallPageObject => cap_t::new_frame_cap( | ||
device_mem, | ||
vm_rights_t::VMReadWrite as _, | ||
0, | ||
ARM_Small_Page, | ||
asidInvalid, | ||
region_base, | ||
), | ||
ObjectType::seL4_ARM_PageUpperDirectoryObject => { | ||
cap_t::new_page_upper_directory_cap(asidInvalid, region_base, 0, 0) | ||
} | ||
ObjectType::seL4_ARM_PageDirectoryObject => { | ||
cap_t::new_page_directory_cap(asidInvalid, region_base, 0, 0) | ||
} | ||
ObjectType::seL4_ARM_PageTableObject => { | ||
cap_t::new_page_table_cap(asidInvalid, region_base, 0, 0) | ||
} | ||
ObjectType::seL4_ARM_PageGlobalDirectoryObject => { | ||
cap_t::new_page_global_directory_cap(asidInvalid, region_base, 0) | ||
} | ||
ObjectType::seL4_ARM_LargePageObject => cap_t::new_frame_cap( | ||
device_mem, | ||
vm_rights_t::VMReadWrite as _, | ||
0, | ||
ARM_Large_Page, | ||
asidInvalid, | ||
region_base, | ||
), | ||
_ => { | ||
unimplemented!( | ||
"create object: {:?} region: {:#x} - {:#x}", | ||
obj_type, | ||
region_base, | ||
region_base + user_size | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[cfg(target_arch = "aarch64")] | ||
pub(crate) mod aarch64; | ||
#[cfg(target_arch = "riscv64")] | ||
pub(crate) mod riscv64; | ||
|
||
#[cfg(target_arch = "aarch64")] | ||
pub use aarch64::*; | ||
#[cfg(target_arch = "riscv64")] | ||
pub use riscv64::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use sel4_common::{arch::{vm_rights_t, ObjectType}, sel4_config::asidInvalid}; | ||
use sel4_cspace::arch::cap_t; | ||
use sel4_vspace::pptr_t; | ||
|
||
|
||
pub fn arch_create_object( | ||
obj_type: ObjectType, | ||
region_base: pptr_t, | ||
user_size: usize, | ||
device_mem: usize, | ||
) -> cap_t { | ||
match obj_type { | ||
ObjectType::PageTableObject => cap_t::new_page_table_cap(asidInvalid, region_base, 0, 0), | ||
|
||
ObjectType::NormalPageObject | ObjectType::GigaPageObject | ObjectType::MegaPageObject => { | ||
cap_t::new_frame_cap( | ||
asidInvalid, | ||
region_base, | ||
obj_type.get_frame_type(), | ||
vm_rights_t::VMReadWrite as usize, | ||
device_mem as usize, | ||
0, | ||
) | ||
} | ||
_ => { | ||
unimplemented!( | ||
"create object: {:?} region: {:#x} - {:#x}", | ||
obj_type, | ||
region_base, | ||
region_base + user_size | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters