[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/5] ARM BE8/BE32 semihosting and gdbstub suppor
Re: [Qemu-devel] [PATCH 1/5] ARM BE8/BE32 semihosting and gdbstub support.
Fri, 4 Nov 2016 09:48:06 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0
On 04/11/2016 00:34, Julian Brown wrote:
> So (IIRC!) the gdbstub needs to interpret some of these read/write
> values on the host, i.e. in host byte ordering. "Traditionally", the
> ldl_p and stl_p (etc.) macros would byteswap depending on the
> TARGET_WORDS_BIGENDIAN setting -- that's how come our internal testing
> using QEMU worked at all in the past. But that's changed with the
> single-binary-for-all-endiannesses patches.
I'm not sure what you mean here... BE8 wasn't supported at all in
system emulation mode before those patches, and there are still two
binaries for user-mode little-endian on one side and BE8/BE32 on the
other. The details of how QEMU distinguished BE8 from BE32 changed
(from bswap_code to SCTLR.B and CPSR.E) but TARGET_WORDS_BIGENDIAN
remained set for qemu-armeb.
The difference for user-mode in fact was very small; for system mode
emulation it was larger because QEMU grew support for all three of
CPSR.E, SCTLR.B and SCTLR.EE. But then again there was no
qemu-system-armeb before, maybe it was something you had in your
That said, if indeed gdb expects wire endianness to match ELF
endianness, you have to do something about it indeed in the gdbstub.
But it seems weird to look at CPSR.E, as that would flip values across
SETEND. SCTLR.B|SCTLR.EE seems more plausible. The addition of a CPU
property for reset, as suggested by Peter, would then make a lot of
sense. Each CPU initfn would then look at that property and use it to
initialize (depending on the model) either SCTLR.B or SCTLR.EE.
The change to arm_cpu_memory_rw_debug for BE32 is also interesting. gdb
The stub need not use any particular size or alignment when
gathering data from memory for the response; even if ADDR is
word-aligned and LENGTH is a multiple of the word size, the stub is
free to use byte accesses, or not.
while your change means that gdb actually wants you to do byte accesses.
> So -- all uses of ld*_p and st*_p, and the TARGET_WORDS_BIGENDIAN
> macro, are now suspect in ARM system-emulation mode. The gdbstub.c
> changes appear to fix some of those, but... yeah, there may be
> subtleties remaining, like run-time endian switching by the target.
> Generally it's not ideal, but I'm not sure how to do better.
[Qemu-devel] [PATCH 3/5] Fix arm_semi_flen_cb for BE32 system mode., Julian Brown, 2016/11/03
[Qemu-devel] [PATCH 4/5] ARM BE32 watchpoint fix., Julian Brown, 2016/11/03
[Qemu-devel] [PATCH 5/5] Fix typo in arm_cpu_do_interrupt_aarch32., Julian Brown, 2016/11/03