mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-20 23:36:34 +00:00
Fix params of truncate
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
b5e04ea5ad
commit
e3adb6e482
@ -80,7 +80,7 @@ impl MemoryRegion {
|
|||||||
|
|
||||||
/// Remove range t from self, resulting in 0, 1 or 2 truncated ranges.
|
/// Remove range t from self, resulting in 0, 1 or 2 truncated ranges.
|
||||||
/// We need to have this method since memory regions can overlap.
|
/// We need to have this method since memory regions can overlap.
|
||||||
pub fn truncate(&self, t: MemoryRegion) -> Vec<MemoryRegion> {
|
pub fn truncate(&self, t: &MemoryRegion) -> Vec<MemoryRegion> {
|
||||||
if self.base < t.base {
|
if self.base < t.base {
|
||||||
if self.base + self.len > t.base {
|
if self.base + self.len > t.base {
|
||||||
if self.base + self.len > t.base + t.len {
|
if self.base + self.len > t.base + t.len {
|
||||||
|
@ -172,7 +172,7 @@ pub fn init_memory_regions() {
|
|||||||
for &r_unusable in ®ions_unusable {
|
for &r_unusable in ®ions_unusable {
|
||||||
regions_dst.clear();
|
regions_dst.clear();
|
||||||
for r_usable in &*regions_src {
|
for r_usable in &*regions_src {
|
||||||
regions_dst.append(&mut r_usable.truncate(r_unusable));
|
regions_dst.append(&mut r_usable.truncate(&r_unusable));
|
||||||
}
|
}
|
||||||
swap(regions_src, regions_dst);
|
swap(regions_src, regions_dst);
|
||||||
}
|
}
|
||||||
@ -182,8 +182,8 @@ pub fn init_memory_regions() {
|
|||||||
MEMORY_REGIONS.call_once(|| regions_unusable);
|
MEMORY_REGIONS.call_once(|| regions_unusable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The entry point of kernel code, which should be defined by the package that
|
// The entry point of kernel code, which should be defined by the package that
|
||||||
/// uses jinux-frame.
|
// uses jinux-frame.
|
||||||
extern "Rust" {
|
extern "Rust" {
|
||||||
fn jinux_main() -> !;
|
fn jinux_main() -> !;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user