[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 for-1.7] s390x: fix flat file load on 32 bit
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [PATCH v2 for-1.7] s390x: fix flat file load on 32 bit systems |
Date: |
Thu, 21 Nov 2013 14:29:51 +0100 |
On Thu, 21 Nov 2013 14:52:02 +0200
"Michael S. Tsirkin" <address@hidden> wrote:
> 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.
> In fact ram_addr_t dos not make any sense -
> it's meaning is "memory handle for migration".
>
> And then we can use == -1 everywhere, consistently.
>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
>
> Changes from v1:
> better fix: use int everywhere
> fix all places with same bug (e.g. -kernel was broken too)
>
> hw/s390x/ipl.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
Reviewed-by: Cornelia Huck <address@hidden>