I was doing a checksum of all sectors read from a virtual disk using qemu. I used the MINDRVR driver sample code from http://www.ata-atapi.com/products.htm.
I initialised the virtual disk with all '0's (charater 0). when I read first sector, there is a 'P' character appeared in it, located at the 279th byte. I tried both DMA and PIO, both has 'P' in the first sector. I also wrote a very simple PIO driver myself and it doesn't have the 'P' appeared when reading the first sector.
I can't understand why. Can anyone help? Is it something wrong with the driver or qemu?
Thanks!!!
Weired first sector
It's a bad idea to test for a single byte located in the first sector. If you hand program by PIO to do something, you're using different instructions than the bios method or whatnot. One of those instructions may be the 'P' you're looking at, since all ascii characters translate to numbers, as does machine code. The first sector is also your bootloader. The code there may or may not be shifting your sentinel out of place.
My favorite sentinel has always been 0xbabe, 'cause it makes me cooler than 0xaa55.
Seriously though, if that's not the problem, and indeed it's not finding your sentinel I'd guess your PIO driver is broken.
There's almost never something wrong with Qemu at this point.
My favorite sentinel has always been 0xbabe, 'cause it makes me cooler than 0xaa55.
Seriously though, if that's not the problem, and indeed it's not finding your sentinel I'd guess your PIO driver is broken.
There's almost never something wrong with Qemu at this point.
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies.
- C. A. R. Hoare
- C. A. R. Hoare
-
- Posts: 7
- Joined: Thu Aug 09, 2007 5:08 am
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Seriously though, if that's not the problem, and indeed it's not finding your sentinel I'd guess your PIO driver is broken.
We have nothing to diagnose your problem, we have barely anything to base guesses on. We need to see code.What really happens when reading the first sector (the MBR)? Why only the MBR gives me the weired "p" character, even though I memset the whole sector to '0'?
-
- Posts: 7
- Joined: Thu Aug 09, 2007 5:08 am