[PATCH 0/2] linux-user/nios2: trap and kuser fixes

Richard Henderson posted 2 patches 2 years, 7 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210915174951.1852266-1-richard.henderson@linaro.org
Maintainers: Laurent Vivier <laurent@vivier.eu>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>
target/nios2/cpu.h          |  5 ++-
linux-user/elfload.c        | 35 +++++++++++++++
linux-user/nios2/cpu_loop.c | 85 ++++++++++++++++++++-----------------
target/nios2/translate.c    | 26 +++++++-----
4 files changed, 99 insertions(+), 52 deletions(-)
[PATCH 0/2] linux-user/nios2: trap and kuser fixes
Posted by Richard Henderson 2 years, 7 months ago
Based-on: 20210813131809.28655-1-peter.maydell@linaro.org
("linux-user: Clean up siginfo_t handling for arm, aarch64")
... for force_sig_fault().

Emulation of EXCP_TRAP was really wrong, in that we were using
the contents of R1 when we really wanted the trap immediate.

Emulation of the kuser page was wrong, in that the first word
contains the version, and must be readable.  The easiest way
to fix this is to map real data, but then we have to come up
with some replacement for __kuser_cmpxchg, and the easiest way
to do that is to steal an unused trap number.

Both of these stand in the way of cleaning up SIGSEGV, which
is how the kuser page is currently implemented.

I built a nios2-elf binutils and wrote a couple of asm smoke
tests for this.  So, golden!


r~


Richard Henderson (2):
  linux-user/nios2: Properly emulate EXCP_TRAP
  linux-user/nios2: Map a real kuser page

 target/nios2/cpu.h          |  5 ++-
 linux-user/elfload.c        | 35 +++++++++++++++
 linux-user/nios2/cpu_loop.c | 85 ++++++++++++++++++++-----------------
 target/nios2/translate.c    | 26 +++++++-----
 4 files changed, 99 insertions(+), 52 deletions(-)

-- 
2.25.1

Re: [PATCH 0/2] linux-user/nios2: trap and kuser fixes
Posted by Richard Henderson 2 years, 7 months ago
On 9/15/21 10:49 AM, Richard Henderson wrote:
> Based-on: 20210813131809.28655-1-peter.maydell@linaro.org
> ("linux-user: Clean up siginfo_t handling for arm, aarch64")
> ... for force_sig_fault().

Laurent, while I posted a follow-up to Peter's patch set, I'd prefer to go ahead and merge 
his first.  Just about everything I'm poking about with currently requires force_sig_fault().


r~

Re: [PATCH 0/2] linux-user/nios2: trap and kuser fixes
Posted by Laurent Vivier 2 years, 7 months ago
Le 15/09/2021 à 19:54, Richard Henderson a écrit :
> On 9/15/21 10:49 AM, Richard Henderson wrote:
>> Based-on: 20210813131809.28655-1-peter.maydell@linaro.org
>> ("linux-user: Clean up siginfo_t handling for arm, aarch64")
>> ... for force_sig_fault().
> 
> Laurent, while I posted a follow-up to Peter's patch set, I'd prefer to go ahead and merge his
> first.  Just about everything I'm poking about with currently requires force_sig_fault().
> 

I'm going to send a PR with the "linux-user: split internals out of qemu.h" series, the Peter's
siginfo series will be in the next one.

Thanks,
Laurent