Skip to contentSkip to conversation

ecos and qemu

Qemu-devel Jani Monoses 5 participants 13 messages Jul 23, 2004 – Jul 30, 2004

lore
Share & tools
lore
#0 lore raw

Hello

the eCos RTOS (compiled for x86) seems to be working in qemu.
For a while I thought it wasn't since not all apps worked. I think now it is a problem with the floppy code(either in qemu or in ecos).
The apps are built as bootable floppy images and some of them were lacking sectors so parts of the image were NULLs leading to crashes.
If I turn those same floppy images to bootable iso-s using mkisofs and run qemu-cdrom on them they work all the time.

Jani

#1 lore raw
Quoted 6 lines · Jani Monoses

For a while I thought it wasn't since not all apps worked. I think now it is a problem with the floppy code(either in qemu or in ecos).
The apps are built as bootable floppy images and some of them were lacking sectors so parts of the image were NULLs leading to crashes.
If I turn those same floppy images to bootable iso-s using mkisofs and run qemu-cdrom on them they work all the time.

That's very interesting. At least part of the problem I've had with Windows NT 3.51 appears to be floppy-related. I'll have to see if I can try anything similar.

Signature · 2 lines
"Let others praise ancient times; I am glad I was born in these."
--Ovid (43 BC-18 AD)
#2 lore raw

I'm looking at it right now.
It works also if you extend the floppy image to be 1440M. something like this

dd if=/dev/zero of=$TMP bs=1024 count=1440
dd if=$FLOPPY of=$TMP conv=notrunc
now $TMP has the extended image.

bdrv_read() drops the last part of the image if it's not 512. So if the last part of the image is important.... :)

Jani

Quoted 14 lines

That's very interesting. At least part of the problem I've had with Windows NT 3.51 appears to be floppy-related. I'll have to see if I can try anything similar.

Signature · 9 lines
"Let others praise ancient times; I am glad I was born in these."
--Ovid (43 BC-18 AD)



_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel
#3 lore raw

[Qemu-devel] QEMU floppy problems (was: ecos and qemu)

In reply to Ben Pfaff
Quoted 9 lines · Ben Pfaff
Quoted 6 lines

For a while I thought it wasn't since not all apps worked. I think now it is a problem with the floppy code(either in qemu or in ecos). The apps are built as bootable floppy images and some of them were lacking sectors so parts of the image were NULLs leading to crashes. If I turn those same floppy images to bootable iso-s using mkisofs and run qemu-cdrom on them they work all the time.

That's very interesting. At least part of the problem I've had with Windows NT 3.51 appears to be floppy-related. I'll have to see if I can try anything similar.

I've got floppy problems in OS/2 and Win98 as well. Booting the installation floppies and a win98 boot floppy both works fine, but from a fully installed version of OS/2 and Win98 installed on disk I cannot access the floppies at all.

The difference: booting probably goes through int13 on all systems, i.e. through the bios, but once OS/2 and Win98 later access floppies by programm the fdc directly. So maybe there's a bug in that part of the emulation.

Johannes

#4 lore raw

Re: [Qemu-devel] QEMU floppy problems (was: ecos and qemu)

and this patch fixes it :)
it's ugly though...

does it work for you guys?
Jani

Index: block.c
===================================================================
RCS file: /cvsroot/qemu/qemu/block.c,v
retrieving revision 1.10

block.c +6 -2
diff -u -r1.10 block.c
@@ -311,6 +311,7 @@
 {
     int ret, n, fd;
     int64_t offset;
+    int bytes = 512;
     
     if (!bs->inserted)
         return -1;
@@ -320,7 +321,7 @@
             fd = bs->cow_fd;
             offset = bs->cow_sectors_offset;
         } else if (sector_num == 0 && bs->boot_sector_enabled) {
-            memcpy(buf, bs->boot_sector_data, 512);
+            memcpy(buf, bs->boot_sector_data, bytes);
             n = 1;
             goto next;
         } else {
@@ -335,8 +336,11 @@
             offset += sector_num * 512;
             lseek64(fd, offset, SEEK_SET);
             ret = read(fd, buf, n * 512);
+	    
             if (ret != n * 512) {
-                return -1;
+		if (ret == -1)    
+	                return -1;
+		bytes = ret;
             }
         }
     next:
#9 lore raw

Re: [Qemu-devel] QEMU floppy problems (was: ecos and qemu)

In reply to Johannes Martin
Quoted 4 lines

The difference: booting probably goes through int13 on all systems, i.e. through the bios, but once OS/2 and Win98 later access floppies by

but the bios int13 also runs over qemu doesn't it ?

#5 lore raw

[Qemu-devel] Re: QEMU floppy problems

In reply to Jani Monoses
Quoted 4 lines · Jani Monoses

and this patch fixes it :)
it's ugly though...

does it work for you guys?

I was working with 1440 kB files, not odd-sized files, so I think it's an unrelated problem.

Signature · 4 lines
"Implementation details are beyond the scope of the Java virtual
 machine specification.  One should not assume that every virtual
 machine implementation contains a giant squid."
--"Mr. Bunny's Big Cup o' Java"
#11 lore raw

[Qemu-devel] Re: QEMU floppy problems

In reply to Johannes Martin
Quoted 4 lines · Johannes Martin

The difference: booting probably goes through int13 on all systems, i.e. through the bios, but once OS/2 and Win98 later access floppies by programm the fdc directly. So maybe there's a bug in that part of the emulation.

That was my conclusion too when I tried to look into this. When NT 3.51 boots, it reads the kernel via the BIOS, but then it fails just after it starts the kernel and resets the floppy controller. (It goes by quickly, but you can tell the ordering by adding debug code to the VGA controller that outputs characters to stdout/stderr as they're written to VGA memory and then looking at how this output is interspersed with other debug output.)

Signature · 4 lines
On Perl: "It's as if H.P. Lovecraft, returned from the dead and speaking by
seance to Larry Wall, designed a language both elegant and terrifying for his
Elder Things to write programs in, and forgot that the Shoggoths didn't turn
out quite so well in the long run." --Matt Olson
#10 lore raw

Re: [Qemu-devel] QEMU floppy problems (was: ecos and qemu)

In reply to Jani Monoses
Quoted 3 lines · Jani Monoses
Quoted 2 lines

The difference: booting probably goes through int13 on all systems, i.e. through the bios, but once OS/2 and Win98 later access floppies by

but the bios int13 also runs over qemu doesn't it ?

Yes, it probably does, but it might not rely on some feature of the FDC that OS/2 or Win98/NT need, so the bug or missing feature in the FDC emulation will not be triggered.

Johannes

#12 lore raw

Re: [Qemu-devel] QEMU floppy problems (was: ecos and qemu)

In reply to Johannes Martin
Quoted 16 lines · Johannes Martin
Quoted 9 lines · Ben Pfaff
Quoted 6 lines

For a while I thought it wasn't since not all apps worked. I think now it is a problem with the floppy code(either in qemu or in ecos). The apps are built as bootable floppy images and some of them were lacking sectors so parts of the image were NULLs leading to crashes. If I turn those same floppy images to bootable iso-s using mkisofs and run qemu-cdrom on them they work all the time.

That's very interesting. At least part of the problem I've had with Windows NT 3.51 appears to be floppy-related. I'll have to see if I can try anything similar.

I've got floppy problems in OS/2 and Win98 as well. Booting the installation floppies and a win98 boot floppy both works fine, but from a fully installed version of OS/2 and Win98 installed on disk I cannot access the floppies at all.

Quoted 4 lines

The difference: booting probably goes through int13 on all systems, i.e. through the bios, but once OS/2 and Win98 later access floppies by programm the fdc directly. So maybe there's a bug in that part of the emulation.

That's really interesting, since few weeks ago, when I was playing with Solaris9/x86 in Qemu I've not been able to mount floppy into this OS by volcheck command (as docs say that's for mounting floppy) and so I gave up and used cdrom and manually created isos for transfering necessary tarbals to my solaris9 installation...

Cheers,

Karel
--
Karel Gardas [email protected]
ObjectSecurity Ltd. http://www.objectsecurity.com

#6 lore raw

Re: [Qemu-devel] QEMU floppy problems (was: ecos and qemu)

In reply to Jani Monoses
Quoted 4 lines · Jani Monoses

and this patch fixes it :)
it's ugly though...

does it work for you guys?

No, I cannot read any floppies on Win98 SE or OS/2.

Johannes

#7 lore raw

Re: [Qemu-devel] QEMU floppy problems (was: ecos and qemu)

Quoted 7 lines · On Fri, 30 Jul 2004 12:01:25 +0200 (CEST) Johannes Martin…
Quoted 4 lines · Jani Monoses

and this patch fixes it :)
it's ugly though...

does it work for you guys?

No, I cannot read any floppies on Win98 SE or OS/2.

I know, my fix is for a bug in handling incomplete sectors in the qemu block layer and not in the emulation of the fdc itself.

Jani

#8 lore raw

Re: SPAM[RBL] Re: [Qemu-devel] QEMU floppy problems

In reply to Johannes Martin

For me, this patch works (Win98se + all Win patchs), for read only.

the only problem is when i try to format, crash every time; or when i try to write, in this case qemu crash some times.

machine: athlon-xp
Debian distribution.

Quoted 17 lines · Johannes Martin
Quoted 6 lines · Jani Monoses

and this patch fixes it :)
it's ugly though...

does it work for you guys?

No, I cannot read any floppies on Win98 SE or OS/2.

Johannes