Rant: Emulators

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Rant: Emulators

Post 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.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Rant: Emulators

Post by AJ »

Hi,

Use mtools and you don't need to mount the disk at all.

Cheers,
Adam
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Rant: Emulators

Post 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...
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: Rant: Emulators

Post 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...
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Rant: Emulators

Post 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).
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: Rant: Emulators

Post 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.
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Rant: Emulators

Post 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.
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: Rant: Emulators

Post 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.
quok
Member
Member
Posts: 490
Joined: Wed Oct 18, 2006 10:43 pm
Location: Kansas City, KS, USA

Re: Rant: Emulators

Post 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.
dosfan
Member
Member
Posts: 65
Joined: Tue Oct 14, 2008 1:18 pm
Location: Scotland

Re: Rant: Emulators

Post 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.
All your base are belong to us.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Rant: Emulators

Post 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:

Code: Select all

mmd -i <image> <folder name> ::/
You can also get a script called "mtsetup.sh" (PM me for more information) which lets you allow mtools to do things like this:

Code: Select all

mcopy <file> A:/<path-to-file>
mtsetup.sh also handles partitioned disk images, loads them as C:/.
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Rant: Emulators

Post by Creature »

Hmmm.. that sounds rather interesting, I'll give it a try later today, thanks :).
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Rant: Emulators

Post by pcmattman »

No worries :D.
Post Reply