From 1a62e7767c1215f9668915b42de770e7993711bf Mon Sep 17 00:00:00 2001 From: LoGin Date: Wed, 2 Aug 2023 18:11:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3relibc=E7=9A=84=E5=A4=B4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=B2=A1=E8=83=BD=E8=AF=86=E5=88=AB=5F=5Fdra?= =?UTF-8?q?gonos=5F=5F=E5=AE=9A=E4=B9=89=E7=9A=84=E9=97=AE=E9=A2=98=20(#31?= =?UTF-8?q?5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 ++- kernel/src/mm/ucontext.rs | 4 +++- user/apps/http_server/Makefile | 2 +- user/apps/test_bind/Makefile | 4 ++-- user/apps/test_gettimeofday/Makefile | 2 +- user/apps/test_relibc/Makefile | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4e904bad..3593bba1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -175,7 +175,8 @@ "net.h": "c", "lz4.h": "c", "cmd_test.h": "c", - "cmpxchg.h": "c" + "cmpxchg.h": "c", + "mman.h": "c" }, "C_Cpp.errorSquiggles": "enabled", "esbonio.sphinx.confDir": "", diff --git a/kernel/src/mm/ucontext.rs b/kernel/src/mm/ucontext.rs index 6fc7d89b..dcea48ca 100644 --- a/kernel/src/mm/ucontext.rs +++ b/kernel/src/mm/ucontext.rs @@ -842,6 +842,8 @@ impl LockedVMA { } pub fn unmap(&self, mapper: &mut PageMapper, mut flusher: impl Flusher) { + // todo: 如果当前vma与文件相关,完善文件相关的逻辑 + let mut guard = self.lock(); assert!(guard.mapped); for page in guard.region.pages() { @@ -1116,7 +1118,7 @@ impl VMA { // kdebug!("VMA::zeroed: flusher dropped"); // 清空这些内存 - let virt_iter = VirtPageFrameIter::new(destination, destination.add(page_count)); + let virt_iter: VirtPageFrameIter = VirtPageFrameIter::new(destination, destination.add(page_count)); for frame in virt_iter { let paddr = mapper.translate(frame.virt_address()).unwrap().0; diff --git a/user/apps/http_server/Makefile b/user/apps/http_server/Makefile index d98625a9..2817222c 100644 --- a/user/apps/http_server/Makefile +++ b/user/apps/http_server/Makefile @@ -3,7 +3,7 @@ LD=ld OBJCOPY=objcopy # 修改这里,把它改为你的relibc的sysroot路径 RELIBC_OPT=$(DADK_BUILD_CACHE_DIR_RELIBC_0_1_0) -CFLAGS=-I $(RELIBC_OPT)/include +CFLAGS=-I $(RELIBC_OPT)/include -D__dragonos__ tmp_output_dir=$(ROOT_PATH)/bin/tmp/user output_dir=$(DADK_BUILD_CACHE_DIR_HTTP_SERVER_0_1_0) diff --git a/user/apps/test_bind/Makefile b/user/apps/test_bind/Makefile index 8aaedcd6..ee0f0a37 100644 --- a/user/apps/test_bind/Makefile +++ b/user/apps/test_bind/Makefile @@ -3,10 +3,10 @@ LD=ld OBJCOPY=objcopy # 修改这里,把它改为你的relibc的sysroot路径 RELIBC_OPT=$(DADK_BUILD_CACHE_DIR_RELIBC_0_1_0) -CFLAGS=-I $(RELIBC_OPT)/include +CFLAGS=-I $(RELIBC_OPT)/include -D__dragonos__ tmp_output_dir=$(ROOT_PATH)/bin/tmp/user -output_dir=$(DADK_BUILD_CACHE_DIR_HTTP_SERVER_0_1_0) +output_dir=$(DADK_BUILD_CACHE_DIR_TEST_BIND_0_1_0) LIBC_OBJS:=$(shell find $(RELIBC_OPT)/lib -name "*.o" | sort ) LIBC_OBJS+=$(RELIBC_OPT)/lib/libc.a diff --git a/user/apps/test_gettimeofday/Makefile b/user/apps/test_gettimeofday/Makefile index 3679285b..16c2073e 100644 --- a/user/apps/test_gettimeofday/Makefile +++ b/user/apps/test_gettimeofday/Makefile @@ -3,7 +3,7 @@ LD=ld OBJCOPY=objcopy # 修改这里,把它改为你的relibc的sysroot路径 RELIBC_OPT=$(DADK_BUILD_CACHE_DIR_RELIBC_0_1_0) -CFLAGS=-I $(RELIBC_OPT)/include +CFLAGS=-I $(RELIBC_OPT)/include -D__dragonos__ tmp_output_dir=$(ROOT_PATH)/bin/tmp/user output_dir=$(DADK_BUILD_CACHE_DIR_TEST_GETTIMEOFDAY_0_1_0) diff --git a/user/apps/test_relibc/Makefile b/user/apps/test_relibc/Makefile index 064ea638..bddc9a66 100644 --- a/user/apps/test_relibc/Makefile +++ b/user/apps/test_relibc/Makefile @@ -3,7 +3,7 @@ LD=ld OBJCOPY=objcopy # 修改这里,把它改为你的relibc的sysroot路径 RELIBC_OPT=$(DADK_BUILD_CACHE_DIR_RELIBC_0_1_0) -CFLAGS=-I $(RELIBC_OPT)/include +CFLAGS=-I $(RELIBC_OPT)/include -D__dragonos__ tmp_output_dir=$(ROOT_PATH)/bin/tmp/user output_dir=$(DADK_BUILD_CACHE_DIR_TEST_RELIBC_0_1_0)