qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 03/68] target/arm: Convert Data Processing (r


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 03/68] target/arm: Convert Data Processing (register)
Date: Thu, 22 Aug 2019 10:21:56 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 8/22/19 9:00 AM, Peter Maydell wrote:
> On Mon, 19 Aug 2019 at 22:38, Richard Henderson
> <address@hidden> wrote:
>>
>> Convert the register shifted by immediate form of the data
>> processing insns.  For A32, we cannot yet remove any code
>> because the legacy decoder intertwines the reg-shifted-reg
>> and immediate forms.
>>
>> Signed-off-by: Richard Henderson <address@hidden>
>> ---
>>  target/arm/translate.c | 229 ++++++++++++++++++++++++++++++++++-------
>>  target/arm/a32.decode  |  28 +++++
>>  target/arm/t32.decode  |  43 ++++++++
>>  3 files changed, 264 insertions(+), 36 deletions(-)
> 
> 
>> +#define DO_ANY3(NAME, OP, L, K)                                         \
>> +    static bool trans_##NAME##_rrri(DisasContext *s, arg_s_rrr_shi *a)  \
>> +    { StoreRegKind k = (K); return op_s_rrr_shi(s, a, OP, L, k); }
> 
> It's a bit non-obvious that we can return early via the expression K
> here (for the "trying to do an old-style exception return in usermode"
> case for SUB and MOV), but it does put the check early where we need it.

Yes, I know.  I tried several different alternatives, but the macro expands 3
different functions with 3 different structures, and I couldn't find a way to
work around that.  Especially...

>> +DO_ANY3(SUB, a->s ? gen_sub_CC : tcg_gen_sub_i32, false,
>> +        ({
>> +            StoreRegKind ret = STREG_NORMAL;
>> +            if (a->rd == 15 && a->s) {
>> +                /*
>> +                 * See ALUExceptionReturn:
>> +                 * In User mode, UNPREDICTABLE; we choose UNDEF.
>> +                 * In Hyp mode, UNDEFINED.
>> +                 */
>> +                if (IS_USER(s) || s->current_el == 2) {
>> +                    return false;
>> +                }
>> +                /* There is no writeback of nzcv to PSTATE.  */
>> +                a->s = 0;

... with this modification.  I suppose I could expand the comment above.


r~



reply via email to

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