OSDN Git Service

elf-loader: add more return codes
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 4 Feb 2014 04:04:18 +0000 (15:04 +1100)
committerAlexander Graf <agraf@suse.de>
Wed, 5 Mar 2014 02:06:46 +0000 (03:06 +0100)
commit18674b26788a9e47f1157170234e32ece2044367
treecba0bc536bbd4a924b68997b70b387554831e62c
parent6a2331d12ee7ca9fbcf2a3c22109513ca561a51e
elf-loader: add more return codes

The existing load_elf() just returns -1 if it fails to load ELF. However
it could be smarter than this and tell more about the failure such as
wrong endianness or incompatible platform.

This adds additional return codes for wrong architecture, wrong
endianness and if the image is not ELF at all.

This adds a load_elf_strerror() helper to convert return codes into
string messages.

This fixes handling of what load_elf() returns for s390x, other
callers just check the return value for <0 and this remains unchanged.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
hw/core/loader.c
hw/s390x/ipl.c
include/hw/elf_ops.h
include/hw/loader.h