Code: Select all
qemu-img create -f qcow2 80m.img 80m
Code: Select all
-hdb 80m.img
And here is my full command to start qemu:
Code: Select all
qemu-system-x86_64 -cpu Nehalem,+x2apic -m 512 -enable-kvm -s -S -fda a.img -hdb 80m.img
Code: Select all
//send command to the primary disk of slave controller to get identify info
io_out8(PORT_DISK1_ALT_STA_CTL,0);
io_out8(PORT_DISK1_ERR_FEATURE,0);
io_out8(PORT_DISK1_SECTOR_CNT,0);
io_out8(PORT_DISK1_SECTOR_LOW,0);
io_out8(PORT_DISK1_SECTOR_MID,0);
io_out8(PORT_DISK1_SECTOR_HIGH,0);
io_out8(PORT_DISK1_DEVICE,0xe0);
io_out8(PORT_DISK1_STATUS_CMD,0xec);
Code: Select all
#define PORT_DISK1_DATA 0x170
#define PORT_DISK1_ERR_FEATURE 0x171
#define PORT_DISK1_SECTOR_CNT 0x172
#define PORT_DISK1_SECTOR_LOW 0x173
#define PORT_DISK1_SECTOR_MID 0x174
#define PORT_DISK1_SECTOR_HIGH 0x175
#define PORT_DISK1_DEVICE 0x176
#define PORT_DISK1_STATUS_CMD 0x177
#define PORT_DISK1_ALT_STA_CTL 0x376
Code: Select all
struct Disk_Identify_Info a;
unsigned short *p = NULL;
port_insw(PORT_DISK1_DATA,&a,256);
p = (unsigned short *)&a;
for(int i = 0;i<256;i++){
printk(ORANGE,WHITE,"%x ",*(p+i));
}
Code: Select all
#define port_insw(port,buffer,nr) \
__asm__ __volatile__("rep;insw;mfence;"::"d"(port),"D"(buffer),"c"(nr):"memory")
(Definition of Disk_Identify_Info: https://github.com/bigjr-mkkong/OStest/blob/main/disk.h)
However, I want to know how can I fix this problem or it is normal to get a full 0 identify info in qemu.