Support Windows NT 4
PATCH 1/1 Support Windows NT 4
The following patch allows the CVS version of qemu to install and boot Windows NT 4, as long as the `-isa' flag is used. Without the patch, trying to install NT 4 will fail because no hard disk will be detected. Almost unbelievably, NT 4 won't detect a hard drive unless the CMOS RAM says that it is there.
Even with this fix, WNT4 can't see the hard drives if PCI support is turned on. There must be something else to track down too.
Index: hw/ide.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/ide.c,v
retrieving revision 1.26
ide.c +1 -0
@@ -1875,6 +1875,7 @@ static void ide_init2(IDEState *ide_stat s->heads =16 ; s->sectors =63 ; } +bdrv_set_geometry_hint (s->bs, s->cylinders, s->heads, s->sectors); }if (bdrv_get_type_hint (s->bs) ==BDRV_TYPE_CDROM ) { s->is_cdrom =1 ;
Index: hw/pc.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/pc.c,v
retrieving revision 1.25
pc.c +50 -2
76 lines not on this page · raw message
Signature · 3 lines
"A computer is a state machine. Threads are for people who cant [sic] program state machines." --Alan Cox
Quoted 1 line · Ben Pfaff
+ if (cylinders <= 1024 && cylinders <= 16 && sectors <= 63) {
The second comparison against cylinders should actually be against heads.
Signature · 4 lines
"Unix... is not so much a product as it is a painstakingly compiled oral history of the hacker subculture." --Neal Stephenson
It appears Windows NT 4 Workstation wants 122 Mb to install, but fails unless you give a 124 Mb image to qemu.
I tried successively 122 and 123 Mb and got everytime an error message saying the disk was too small.
(though the disk size was computed correctly)
Quoted 8 lines · --- Ben Pfaff
The following patch allows the CVS version of qemu to install and boot Windows NT 4, as long as the `-isa' flag is used. Without the patch, trying to install NT 4 will fail because no hard disk will be detected. Almost unbelievably, NT 4 won't detect a hard drive unless the CMOS RAM says that it is there.
Even with this fix, WNT4 can't see the hard drives if PCI support is turned on. There must be something else to track down too.
=====
Sylvain Petreolle (spetreolle_at_users_dot_sourceforge_dot_net) Say NO to software patents
Dites NON aux brevets logiciels
"You believe it's the year 1984, when in fact, its closer to 2184"1984 / Matrix
Créez gratuitement votre Yahoo! Mail avec 100 Mo de stockage ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/
Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !Téléchargez Yahoo! Messenger sur http://fr.messenger.yahoo.com
Quoted 5 lines · Sylvain Petreolle
It appears Windows NT 4 Workstation wants 122 Mb to install, but fails unless you give a 124 Mb image to qemu.
I tried successively 122 and 123 Mb and got everytime an error message saying the disk was too small.
(though the disk size was computed correctly)
At the other end of the size spectrum, I can't get disks bigger than 504 MB to work. It is undoubtedly some kind of CHS<->LBA translation issue, but I couldn't figure out what kind.
Signature · 2 lines
"Debian for hackers, Red Hat for suits, Slackware for loons." --CmdrTaco <URL:http://slashdot.org/articles/99/03/22/0928207.shtml>
Quoted 4 lines · On Sat, 17 Jul 2004, [iso-8859-1] Sylvain Petreolle wrote:
Quoted 2 lines · --- Ben Pfaff
Even with this fix, WNT4 can't see the hard drives if PCI support is turned on. There must be something else to track down too.
Interesting, Solaris has problems too if it tries to use its pci-ide driver to access the disks. Disk access times out and returns error code 0x03. Using the Solaris isa 'ata' driver works fine though.
regardsm
Signature · 5 lines
Paul Jakma [email protected] [email protected] Key ID: 64A2FF6A warning: do not ever send email to [email protected] Fortune: "The value of marriage is not that adults produce children, but that children produce adults." -- Peter De Vries
Fabrice Bellard
AppliedApplied.
Fabrice.
Quoted 112 lines · Ben Pfaff
The following patch allows the CVS version of qemu to install and boot Windows NT 4, as long as the `-isa' flag is used. Without the patch, trying to install NT 4 will fail because no hard disk will be detected. Almost unbelievably, NT 4 won't detect a hard drive unless the CMOS RAM says that it is there.
Even with this fix, WNT4 can't see the hard drives if PCI support is turned on. There must be something else to track down too.
Index:
hw/ide.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/ide.c,v
retrieving revision 1.26
diff -u -p -u -r1.26ide.cide.c +1
-0@@ -1875,6 +1875,7 @@ static void ide_init2(IDEState *ide_stat s->heads =16 ; s->sectors =63 ; } +bdrv_set_geometry_hint (s->bs, s->cylinders, s->heads, s->sectors); }if (bdrv_get_type_hint (s->bs) ==BDRV_TYPE_CDROM ) { s->is_cdrom =1 ;Index:
hw/pc.c
===================================================================
RCS file: /cvsroot/qemu/qemu/hw/pc.c,v
retrieving revision 1.25
diff -u -p -u -r1.25pc.cpc.c +50
-2@@ -101,13 +101,32 @@ static int cmos_get_fd_drive_type(int fdreturn val; } -static void cmos_init (int ram_size,int boot_device) +static void cmos_init_hd (int type_ofs,int info_ofs,BlockDriverState *hd) +{ +RTCState *s = rtc_state; +int cylinders, heads, sectors; +bdrv_get_geometry_hint (hd, &cylinders, &heads, §ors); +rtc_set_memory (s, type_ofs,47 ); +rtc_set_memory (s, info_ofs, cylinders); +rtc_set_memory (s, info_ofs +1 , cylinders >>8 ); +rtc_set_memory (s, info_ofs +2 , heads); +rtc_set_memory (s, info_ofs +3 ,0xff ); +rtc_set_memory (s, info_ofs +4 ,0xff ); +rtc_set_memory (s, info_ofs +5 ,0xc0 | ((heads >8 ) <<3 )); +rtc_set_memory (s, info_ofs +6 , cylinders); +rtc_set_memory (s, info_ofs +7 , cylinders >>8 ); +rtc_set_memory (s, info_ofs +8 , sectors); +} + +/* hd_table must contain 4 block drivers */ +static void cmos_init (int ram_size,int boot_device,BlockDriverState **hd_table) {RTCState *s = rtc_state;int val;int fd0, fd1, nb;time_t ti;struct tm *tm; +int i;/* set the CMOS date */ time (&ti);@@ -187,6 +206,35 @@ static void cmos_init(int ram_size, int val |=0x04 ;/* PS/2 mouse installed */ rtc_set_memory (s,REG_EQUIPMENT_BYTE , val); +/* hard drives */ + +rtc_set_memory (s,0x12 , (hd_table[0 ] ?0xf0 :0 ) | (hd_table[1 ] ?0x0f :0 )); +if (hd_table[0 ]) +cmos_init_hd (0x19 ,0x1b , hd_table[0 ]); +if (hd_table[1 ]) +cmos_init_hd (0x1a ,0x24 , hd_table[1 ]); + + val =0 ; +for (i =0 ; i <4 ; i++) +if (hd_table[i]) { +int cylinders, heads, sectors; +uint8_t translation; + +bdrv_get_geometry_hint (hd_table[i], &cylinders, &heads, §ors); +if (cylinders <=1024 && cylinders <=16 && sectors <=63 ) { +/* No translation. */ + translation =0 ; + }else if (cylinders * heads >131072 ) { +/* LBA translation. */ + translation =1 ; + }else { +/* LARGE translation. */ + translation =2 ; + } + + val |= translation << (i *2 ); + } +rtc_set_memory (s,0x39 , val); }static void speaker_ioport_write (void *opaque,uint32_t addr,uint32_t val)@@ -506,7 +554,7 @@ void pc_init(int ram_size, int vga_ram_s floppy_controller =fdctrl_init (6 ,2 ,0 ,0x3f0 , fd_table); -cmos_init (ram_size, boot_device); +cmos_init (ram_size, boot_device, bs_table);/* must be done after all PCI devices are instanciated */ /* XXX: should be done in the Bochs BIOS */