*--------------------------------------------------------------------------
*/
#include <fs.h>
-#include <ide.h>
#include <printk.h>
#include <stdlib.h>
#include <string.h>
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);
#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;
#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
#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))
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:");
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 \