From d4b93c4badff473b3bb74325c3bc08c6fcb1f907 Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Sun, 30 Jun 2024 21:38:49 +0800 Subject: [PATCH] book: ch4: MapArea::copy_data does not require &mut PageTable Reference: https://github.com/rcore-os/rCore-Tutorial-v3/issues/133 --- source/chapter4/5kernel-app-spaces.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/chapter4/5kernel-app-spaces.rst b/source/chapter4/5kernel-app-spaces.rst index 876f0a93f..dbee84176 100644 --- a/source/chapter4/5kernel-app-spaces.rst +++ b/source/chapter4/5kernel-app-spaces.rst @@ -107,7 +107,7 @@ 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); } @@ -170,7 +170,7 @@ } /// 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();