Page 2 of 2
Re: Rant: Emulators
Posted: Thu Mar 12, 2009 10:06 am
by Creature
The mount -> copy -> unmount way does work, but it's still pretty lame that QEMU can't just recognize any boot floppy from virtual floppy drive (and I have no idea why, as it worked perfectly before and why else would there be support for an -fda \\.\A: option?) which would save the time of unmounting all the time.
Re: Rant: Emulators
Posted: Thu Mar 12, 2009 3:01 pm
by AJ
Hi,
Use mtools and you don't need to mount the disk at all.
Cheers,
Adam
Re: Rant: Emulators
Posted: Thu Mar 12, 2009 8:23 pm
by earlz
Creature wrote:The mount -> copy -> unmount way does work, but it's still pretty lame that QEMU can't just recognize any boot floppy from virtual floppy drive (and I have no idea why, as it worked perfectly before and why else would there be support for an -fda \\.\A: option?) which would save the time of unmounting all the time.
go dive into the qemu source and implement it then.. there is a reason its not implemented.. cause windows is dumb and doesn't treat block devices the same way as files...
Re: Rant: Emulators
Posted: Fri Mar 13, 2009 3:56 am
by ru2aqare
earlz wrote:go dive into the qemu source and implement it then.. there is a reason its not implemented.. cause windows is dumb and doesn't treat block devices the same way as files...
Well if Bochs can use a floppy drive (a physical one), there is no reason Qemu couldn't use one...
Re: Rant: Emulators
Posted: Fri Mar 13, 2009 9:41 am
by Creature
ru2aqare wrote:earlz wrote:go dive into the qemu source and implement it then.. there is a reason its not implemented.. cause windows is dumb and doesn't treat block devices the same way as files...
Well if Bochs can use a floppy drive (a physical one), there is no reason Qemu couldn't use one...
That's what I thought, and the documentation says it can, by using something like 'fda \\.\A:' but QEMU just doesn't recognize it as a boot device then for some reason. It could also be a new bug occurring in the new version.
Hi,
Use mtools and you don't need to mount the disk at all.
Cheers,
Adam
I've just compiled mtools with Cygwin, though I'm not really sure how to use it, it keeps giving me a list of commands (I'll search for some documentation soon).
Re: Rant: Emulators
Posted: Fri Mar 13, 2009 10:12 am
by yemista
The way I see it is we are extremley fortunate to even have emulator options, because without them Im pretty sure most of us would have no chance at OS development. You cannot debug by testing on a PC. Ive never had a problem with Bochs, but if it does have some minor problems, there is enough in there that you can figure another way to find what you want.
Re: Rant: Emulators
Posted: Fri Mar 13, 2009 11:54 am
by quok
yemista wrote:You cannot debug by testing on a PC.
Um, really? What about implementing serial port support and doing remote GDB debugging? Or using debugging printfs/printks? Stack tracing isn't too hard to implement either. You could throw all your debug statements out a serial port (and have that serial port be attached to another computer, or just an old line printer). The only problem here is the need for some extra equipment, but you should really have that anyway. How many people that are developing their own OS don't have a second PC to test on?
Of course, you can always implement an in-kernel debugger as well. All of these techniques are covered on our very own wiki, and other threads on these forums as well. Debugging your OS code by testing on a PC is not only doable, but it's also something that must be done, or you end up with an OS that runs correctly only on your computer. Although I'm sure that's fine for some people.
Re: Rant: Emulators
Posted: Fri Mar 13, 2009 1:29 pm
by JohnnyTheDon
Yes, but debugging like that every time you change the littlest thing is quite annoying and time consumming, especially early on when you make plenty of mistakes that cause triple-faults and such (which will not be caught by in-kernel debugging). It is possible to develop an OS without an emulator, but having one does make it a lot easier.
Re: Rant: Emulators
Posted: Fri Mar 13, 2009 3:53 pm
by quok
JohnnyTheDon wrote:Yes, but debugging like that every time you change the littlest thing is quite annoying and time consumming, especially early on when you make plenty of mistakes that cause triple-faults and such (which will not be caught by in-kernel debugging). It is possible to develop an OS without an emulator, but having one does make it a lot easier.
Sure it's time consuming and perhaps even a bit harder, but that's not the point I was arguing.
It was said that it's not possible, and it certainly is. In fact, it's even needed. Neither qemu nor bochs correctly emulate all aspects of an x86 CPU. It's completely possible to write code that will work in an emulator, but not on real hardware. When that happens, you'll need to be able to debug your code on a real PC. Time consuming or not, it's best to take the extra time and steps to test your code often on a real PC, even at the low levels.
Re: Rant: Emulators
Posted: Sat Mar 14, 2009 12:58 pm
by dosfan
I noticed when using VFD and QEMU on Windows, I had to insert a delay between copying my kernel to A: and starting QEMU. I done this simply using a pause in the batch file. By the time I press the key a long enough delay has elapsed.
It seemed like Windows didn't want to grant the exculsive access to the floppy device as it was probably still writing the data when QEMU tried to open it.
-fda "\\.\a:" works for me in 0.9 atleast. I use QEMU and VFD on a daily basis with no mounting/unmounting.
Re: Rant: Emulators
Posted: Sat Mar 21, 2009 12:12 am
by pcmattman
I've just compiled mtools with Cygwin, though I'm not really sure how to use it, it keeps giving me a list of commands (I'll search for some documentation soon).
For copying a file to an image:
Code: Select all
mcopy -i <image> <path_to_file_to_copy> ::/<path_to_destination>
Creating a folder:
You can also get a script called "mtsetup.sh" (PM me for more information) which lets you allow mtools to do things like this:
mtsetup.sh also handles partitioned disk images, loads them as C:/.
Re: Rant: Emulators
Posted: Sat Mar 21, 2009 3:52 am
by Creature
Hmmm.. that sounds rather interesting, I'll give it a try later today, thanks
.
Re: Rant: Emulators
Posted: Sun Mar 22, 2009 6:25 am
by pcmattman
No worries
.