]> git.proxmox.com Git - qemu.git/commit
s390x: fix flat file load on 32 bit systems
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 21 Nov 2013 13:34:26 +0000 (15:34 +0200)
committerAnthony Liguori <aliguori@amazon.com>
Thu, 21 Nov 2013 15:55:10 +0000 (07:55 -0800)
commit376827d48922941d16ef9949672e86f820005d0a
tree6625a70db6873cd9a7aa8bac834f09df5add4876
parentb15654c21acef4d2bc17e6ac528c6c93abbb7e1e
s390x: fix flat file load on 32 bit systems

pc-bios/s390-zipl.rom is a flat image so it's expected that
loading it as elf will fail.
It should fall back on loading a flat file, but doesn't
on 32 bit systems, instead it fails printing:
    qemu: hardware error: could not load bootloader 's390-zipl.rom'

The result is boot failure.

The reason is that a 64 bit unsigned interger which is set
to -1 on error is compared to -1UL which on a 32 bit system
with gcc is a 32 bit unsigned interger.
Since both are unsigned, no sign extension takes place and
comparison evaluates to non-equal.

There's no reason to do clever tricks: all functions
we call actually return int so just use int.
And then we can use == -1 everywhere, consistently.

Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20131121133426.GA30827@redhat.com
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
hw/s390x/ipl.c