[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] PPC: Allow little-endian user mo
From: |
Peter Maydell |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] PPC: Allow little-endian user mode. |
Date: |
Thu, 8 May 2014 13:39:28 +0100 |
On 8 May 2014 09:39, Alexander Graf <address@hidden> wrote:
> On 05/08/2014 10:26 AM, Doug Kwan wrote:
>>
>> This all running PPC64 little-endian in user mode if target is configured
>> that way. In PPC64 LE user mode we set MSR.LE during initialization.
>> Byteswapping logic is reversed also when QEMU is running in that mode.
>>
>> Signed-off-by: Doug Kwan <address@hidden>
>
>
> I can't say I'm a huge fan of this patch. It allows for really tricky
> subtile mistakes to happen. Can't we leave the target mode configured on big
> endian?
Unfortunately not if you care about linux-user mode:
linux-user mode uses the target-endian setting to figure
out if it needs to do swapping of data in all the syscall
interfaces.
If you're going to overhaul how PPC deals with endian
dependent loads/stores, I suspect you'll end up with a
cleaner result if you convert to the new "specify endian
setting as part of the memory operation" TCG ops:
So for instance rather than having:
tcg_gen_qemu_ld16u(arg1, arg2, ctx->mem_idx);
if (unlikely(ctx->le_mode)) {
tcg_gen_bswap16_tl(arg1, arg1);
}
it would be better to do
TCGMemOp op = MO_UW | (ctx->le_mode ? MO_LE : MO_BE);
tcg_gen_qemu_ld_i32(arg1, arg2, ctx->mem_idx, op);
This will work regardless of the TARGET_WORD_BIGENDIAN
setting, since we directly ask TCG to do an LE or BE
access, rather than doing a target-endian access and
then swapping. (It's also more efficient if you're
in little-endian mode on a little endian host since
it won't swap at all rather than swapping twice.)
thanks
-- PMM
- Re: [Qemu-ppc] [PATCH 1/3] linux-user: Handle ELFv2 PPC64 binaries in user mode., (continued)
[Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., Doug Kwan, 2014/05/08
- Re: [Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., Alexander Graf, 2014/05/08
- Re: [Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., 關振德, 2014/05/08
- Re: [Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., Alexander Graf, 2014/05/08
- Re: [Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., 關振德, 2014/05/08
- Re: [Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., Alexander Graf, 2014/05/08
- Re: [Qemu-ppc] [PATCH 2/3] PPC: Allow little-endian user mode., 關振德, 2014/05/08
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] PPC: Allow little-endian user mode.,
Peter Maydell <=
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] PPC: Allow little-endian user mode., Alexander Graf, 2014/05/08
[Qemu-ppc] [PATCH 3/3] configure: Add new target ppc64el-linux-user, Doug Kwan, 2014/05/08
Re: [Qemu-ppc] [Qemu-devel] [PATCH 3/3] configure: Add new target ppc64el-linux-user, Andreas Färber, 2014/05/08