Commit f790642c authored by LEOibyug's avatar LEOibyug
Browse files

busybox fix

parent d40df2ee
No related merge requests found
Showing with 14 additions and 5 deletions
+14 -5
......@@ -98,10 +98,11 @@ impl<B: MappingBackend> MemoryArea<B> {
}
/// Maps the whole memory area in the page table.
pub fn map_area(&mut self, page_table: &mut B::PageTable) -> MappingResult {
pub fn map_area(&mut self, page_table: &mut B::PageTable,flags:Option<B::Flags>) -> MappingResult {
let flag = flags.unwrap_or(self.flags);
let frame_refs = self
.backend
.map(self.start(), self.size(), self.flags, page_table)
.map(self.start(), self.size(), flag, page_table)
.or(Err(MappingError::BadState))?;
#[cfg(feature = "RAII")]
self.frames.extend(frame_refs);
......
......@@ -120,6 +120,7 @@ impl<B: MappingBackend> MemorySet<B> {
mut area: MemoryArea<B>,
page_table: &mut B::PageTable,
unmap_overlap: bool,
flags:Option<B::Flags>,
) -> MappingResult {
if area.va_range().is_empty() {
return Err(MappingError::InvalidParam);
......@@ -133,7 +134,7 @@ impl<B: MappingBackend> MemorySet<B> {
}
}
area.map_area(page_table)?;
area.map_area(page_table,flags)?;
assert!(self.areas.insert(area.start(), area).is_none());
Ok(())
}
......
......@@ -91,6 +91,7 @@ fn test_map_unmap() {
MemoryArea::new(start.into(), 0x1000, 1, MockBackend),
&mut pt,
false,
None
));
}
// Map [0x1000, 0x2000), [0x3000, 0x4000), [0x5000, 0x6000), ...
......@@ -99,6 +100,7 @@ fn test_map_unmap() {
MemoryArea::new(start.into(), 0x1000, 2, MockBackend),
&mut pt,
false,
None
));
}
dump_memory_set(&set);
......@@ -119,7 +121,8 @@ fn test_map_unmap() {
set.map(
MemoryArea::new(0x4000.into(), 0x4000, 3, MockBackend),
&mut pt,
false
false,
None
),
AlreadyExists
);
......@@ -127,7 +130,8 @@ fn test_map_unmap() {
assert_ok!(set.map(
MemoryArea::new(0x4000.into(), 0x4000, 3, MockBackend),
&mut pt,
true
true,
None
));
dump_memory_set(&set);
assert_eq!(set.len(), 13);
......@@ -163,6 +167,7 @@ fn test_unmap_split() {
MemoryArea::new(start.into(), 0x1000, 1, MockBackend),
&mut pt,
false,
None
));
}
assert_eq!(set.len(), 8);
......@@ -249,6 +254,7 @@ fn test_protect() {
MemoryArea::new(start.into(), 0x1000, 0x7, MockBackend),
&mut pt,
false,
None
));
}
assert_eq!(set.len(), 8);
......@@ -338,6 +344,7 @@ fn test_find_free_area() {
MemoryArea::new(start.into(), 0x1000, 1, MockBackend),
&mut pt,
false,
None
));
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment