[SeaBIOS] Problem accessing a small virtio disk

Kevin O'Connor kevin at koconnor.net
Thu Jun 14 02:52:56 CEST 2012


On Wed, Jun 13, 2012 at 04:51:04PM +0300, Gleb Natapov wrote:
> I noticed that SeaBIOS fails to boot from virtio disk smaller than 512K.
> The attempt to access a disk fails at basic_access().
> (cylinder >= nlc || head >= nlh || sector > nlspt) is true because nlc
> is zero. The problem seams to be in how SeaBIOS calculates lchs from
> pchs in get_translation(). Both QEMU and SeaBIOS fake disk geometry from
> real disk size, but it seams that they do it differently and when they
> disagree part of the disk may not be readable.

The LBA translation code comes from the original Bochs BIOS code.
Looking at this now, I think it's not rounding properly and thus
causing some sectors to get truncated.

> What would be the best way to fix that?

If there's a better way to calculate a logical CHS then I'm open to
fixing it in SeaBIOS.

-Kevin



More information about the SeaBIOS mailing list