From eeb8ac2352a12ec22c0a627d69ab369a63b0f574 Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Sun, 30 Jun 2024 20:09:43 +0800 Subject: [PATCH] mm: bugfix #133: MapArea::copy_data does not need &mut PageTable --- os/src/mm/memory_set.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/os/src/mm/memory_set.rs b/os/src/mm/memory_set.rs index 8b2b48f0..a2c31cd1 100644 --- a/os/src/mm/memory_set.rs +++ b/os/src/mm/memory_set.rs @@ -79,7 +79,7 @@ impl MemorySet { fn push(&mut self, mut map_area: MapArea, data: Option<&[u8]>) { map_area.map(&mut self.page_table); if let Some(data) = data { - map_area.copy_data(&mut self.page_table, data); + map_area.copy_data(&self.page_table, data); } self.areas.push(map_area); } @@ -339,7 +339,7 @@ impl MapArea { } /// data: start-aligned but maybe with shorter length /// assume that all frames were cleared before - pub fn copy_data(&mut self, page_table: &mut PageTable, data: &[u8]) { + pub fn copy_data(&mut self, page_table: &PageTable, data: &[u8]) { assert_eq!(self.map_type, MapType::Framed); let mut start: usize = 0; let mut current_vpn = self.vpn_range.get_start();