From 2fb6fb536459596698f50c8da52d870ffb4d4a5b Mon Sep 17 00:00:00 2001 From: acevest Date: Fri, 29 Oct 2021 07:35:39 +0800 Subject: [PATCH] fix gdtr idtr --- .gitignore | 1 + include/system.h | 2 +- kernel/system.c | 3 +++ scripts/init.sh | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 67abe43..d312213 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ bin/hello bin/shell a.* snapshot.txt +*.lock diff --git a/include/system.h b/include/system.h index c72fb0f..ea8dbf6 100644 --- a/include/system.h +++ b/include/system.h @@ -67,7 +67,7 @@ void kfree(void *addr); extern char etext, edata, end; -char gdtr[6],idtr[6]; +extern char gdtr[6],idtr[6]; #define lgdt() __asm__ __volatile__("lgdt gdtr") #define sgdt() __asm__ __volatile__("sgdt gdtr") #define lidt() __asm__ __volatile__("lidt idtr") diff --git a/kernel/system.c b/kernel/system.c index 7035db0..2579677 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -187,3 +187,6 @@ void system_delay() } irq_restore(flags); } + + +char gdtr[6],idtr[6]; diff --git a/scripts/init.sh b/scripts/init.sh index 65dc7a2..d44e3bd 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -5,6 +5,8 @@ HDIMG=out.img TMP=build/tmp MNT=$TMP/mnt +mkdir -p ${MNT} + # 生成硬盘 dd if=/dev/zero of=$HDIMG bs=512 count=24576 -- 2.44.0