]> 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 11:59:15 +0000 (13:59 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 21 Nov 2013 14:25:07 +0000 (16:25 +0200)
commitdecbc880289526d94495bcbe6e1ba2a11b92e7a8
tree560eacb271b49bf79da08b0f850039b9be9f55f3
parent394cfa39ba24dd838ace1308ae24961243947fb8
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>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/s390x/ipl.c