linux-0.11调试教程,minix文件系统1.0上篇(01),硬盘基本参数hd_info

下面是在mount_root下断点。

地址0x191e4是hd_info[0]的结构地址,而0x90080是setup.s中设置的

linux-0.11调试教程,minix文件系统1.0上篇(01),硬盘基本参数hd_info_第1张图片

相关代码是:

for (drive=0 ; drive<2 ; drive++) {
        hd_info[drive].cyl = *(unsigned short *) BIOS;
        hd_info[drive].head = *(unsigned char *) (2+BIOS);
        hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
        hd_info[drive].ctl = *(unsigned char *) (8+BIOS);
        hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
        hd_info[drive].sect = *(unsigned char *) (14+BIOS);
        BIOS += 16;
    }


和bochsrc-hd.bxrc文件中的内容是一致的。

ata0-master: type=disk, path="hdc-0.11.img", mode=flat, cylinders=121, heads=16, spt=63


hd_info结构定义:

struct hd_i_struct {
    int head,sect,cyl,wpcom,lzone,ctl;
    };
#ifdef HD_TYPE
struct hd_i_struct hd_info[] = { HD_TYPE };
#define NR_HD ((sizeof (hd_info))/(sizeof (struct hd_i_struct)))
#else
struct hd_i_struct hd_info[] = { {0,0,0,0,0,0},{0,0,0,0,0,0} };
static int NR_HD = 0;
#endif



你可能感兴趣的:(linux-0.11调试教程,minix文件系统1.0上篇(01),硬盘基本参数hd_info)