From: acevest Date: Sun, 15 Oct 2023 02:43:57 +0000 (+0800) Subject: 更改硬盘设备号的表示方法 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=a15078a6a8fde260b5ac63a7c226806451d7dcab;p=kernel.git 更改硬盘设备号的表示方法 --- diff --git a/boot/cmdline.c b/boot/cmdline.c index 534191d..b698e4c 100644 --- a/boot/cmdline.c +++ b/boot/cmdline.c @@ -10,7 +10,6 @@ *-------------------------------------------------------------------------- */ #include -#include #include #include #include diff --git a/drivers/ide.c b/drivers/ide.c index 4a9e332..dfe96f8 100644 --- a/drivers/ide.c +++ b/drivers/ide.c @@ -178,7 +178,7 @@ ide_drive_t *ide_get_drive(dev_t dev) { int major = DEV_MAJOR(dev); int minor = DEV_MINOR(dev); - int drv_no = minor / MAX_DISK_PARTIONS; + int drv_no = (minor & 0xFFFF) >> 8; assert(major == DEV_MAJOR_DISK); assert(minor >= 0); diff --git a/drivers/ide.h b/drivers/ide.h index 743bb0b..91a7c5d 100644 --- a/drivers/ide.h +++ b/drivers/ide.h @@ -153,8 +153,6 @@ #define PARTITION_TABLE_OFFSET 0x1BE #define MAX_DISK_PARTIONS 16 -#define MAKE_DISK_DEV(drv_no, part_no) MAKE_DEV(DEV_MAJOR_DISK, (drv_no)*MAX_DISK_PARTIONS + (part_no)) - // 分区定义 typedef struct ide_part_ { uint8_t flags; diff --git a/include/fs.h b/include/fs.h index 77bb046..b84216f 100644 --- a/include/fs.h +++ b/include/fs.h @@ -24,8 +24,6 @@ #define DEV_MAJOR_MEM 0x0001 #define DEV_MAJOR_TTY 0x0002 #define DEV_MAJOR_DISK 0x0003 -// #define DEV_MAJOR_IDE0 0x0003 -// #define DEV_MAJOR_HDA DEV_MAJOR_IDE0 #define DEV_MAJOR_IDE1 0x0004 #define DEV_MAJOR_SCSI0 0x0005 #define DEV_MAJOR_SCSI2 0x0006 @@ -34,6 +32,7 @@ #define DEV_MINOR_MASK ((1UL << DEV_MAJOR_BITS) - 1) #define MAKE_DEV(major, minor) ((major) << DEV_MAJOR_BITS | minor) +#define MAKE_DISK_DEV(drv_no, part_no) MAKE_DEV(DEV_MAJOR_DISK, (((drv_no)&0x03) << 8) | (((part_no)&0xFF) << 0)) #define DEV_MAJOR(dev) ((unsigned int)((dev) >> DEV_MAJOR_BITS)) #define DEV_MINOR(dev) ((unsigned int)((dev)&DEV_MINOR_MASK)) diff --git a/mm/buddy.c b/mm/buddy.c index 0184743..15dd0ee 100644 --- a/mm/buddy.c +++ b/mm/buddy.c @@ -158,7 +158,7 @@ void dump_buddy_system() { for (i = 0; i < MAX_ORDER; ++i) { printk("order %2d free_count %d ", i, buddy_system.free_area[i].free_count); - if (buddy_system.free_area[i].free_count < 100) { + if (buddy_system.free_area[i].free_count < 1000) { list_head_t *p; page_t *page; printk("pfn:"); diff --git a/qemu.sh b/qemu.sh index 978feb4..190db49 100755 --- a/qemu.sh +++ b/qemu.sh @@ -17,7 +17,7 @@ set -m qemu-system-i386 \ -boot d \ -serial tcp::6666,server,nowait \ - -drive file=HDa.IMG,format=raw,index=0,media=disk \ + -drive file=HD.IMG,format=raw,index=0,media=disk \ -drive file=kernel.iso,index=1,media=cdrom \ -drive file=HDb.IMG,format=raw,index=2,media=disk \ -name kernel \