qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH for-6.2 12/43] target/sh4: Implement do_unaligned_access for


From: Rob Landley
Subject: Re: [PATCH for-6.2 12/43] target/sh4: Implement do_unaligned_access for user-only
Date: Fri, 30 Jul 2021 15:54:53 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0


On 7/29/21 8:52 AM, Peter Maydell wrote:
> On Thu, 29 Jul 2021 at 02:01, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>  linux-user/sh4/cpu_loop.c | 8 ++++++++
>>  target/sh4/cpu.c          | 2 +-
>>  target/sh4/op_helper.c    | 3 ---
>>  3 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c
>> index 222ed1c670..21d97250a8 100644
>> --- a/linux-user/sh4/cpu_loop.c
>> +++ b/linux-user/sh4/cpu_loop.c
>> @@ -71,6 +71,14 @@ void cpu_loop(CPUSH4State *env)
>>              info._sifields._sigfault._addr = env->tea;
>>              queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
>>              break;
>> +        case 0xe0:
>> +        case 0x100:
>> +            info.si_signo = TARGET_SIGBUS;
>> +            info.si_errno = 0;
>> +            info.si_code = TARGET_BUS_ADRALN;
>> +            info._sifields._sigfault._addr = env->tea;
>> +            queue_signal(env, info.si_signo, QEMU_SI_FAULT, &info);
>> +            break;
> 
> sh4 kernel default for unaligned accesses seems to be "warn and fixup",
> not SIGBUS, unless the user changes that by writing to /proc/cpu/alignment
> or the process changes it via prctl().

It's still good to know, qemu-sh4 runs j-core binaries but that target doesn't
have unaligned interrupts yet. (I think it just masks off the bottom 2 bits to
do the next lowest aligned access? It's an sh2 variant and the plumbing to let
interrupts restart multi-clock instructions is only in the j32 branch so far, so
the j2 and ice40 targets don't generate interrupts for it. Todo item, in the
meantime we need to clean unaligned access out of application code so faulting
on it is good.)

> -- PMM

Thanks,

Rob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]