• Cédric Le Goater's avatar
    KVM: PPC: Book3S: MMIO emulation support for little endian guests · 73601775
    Cédric Le Goater authored
    MMIO emulation reads the last instruction executed by the guest
    and then emulates. If the guest is running in Little Endian order,
    or more generally in a different endian order of the host, the
    instruction needs to be byte-swapped before being emulated.
    
    This patch adds a helper routine which tests the endian order of
    the host and the guest in order to decide whether a byteswap is
    needed or not. It is then used to byteswap the last instruction
    of the guest in the endian order of the host before MMIO emulation
    is performed.
    
    Finally, kvmppc_handle_load() of kvmppc_handle_store() are modified
    to reverse the endianness of the MMIO if required.
    Signed-off-by: default avatarCédric Le Goater <clg@fr.ibm.com>
    [agraf: add booke handling]
    Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
    73601775
emulate.c 11.7 KB