qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v4 27/40] target/arm: Add VHE system register redirection and


From: Richard Henderson
Subject: Re: [PATCH v4 27/40] target/arm: Add VHE system register redirection and aliasing
Date: Fri, 6 Dec 2019 10:53:59 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1

On 12/6/19 10:41 AM, Peter Maydell wrote:
> On Fri, 6 Dec 2019 at 18:36, Richard Henderson
> <address@hidden> wrote:
> 
>>>> +static void el2_e2h_write(CPUARMState *env, const ARMCPRegInfo *ri,
>>>> +                          uint64_t value)
>>>> +{
>>>> +    CPWriteFn *writefn;
>>>> +
>>>> +    if (redirect_for_e2h(env)) {
>>>> +        /* Switch to the saved EL2 version of the register.  */
>>>> +        ri = ri->opaque;
>>>> +        writefn = ri->writefn;
>>>> +    } else {
>>>> +        writefn = ri->orig_writefn;
>>>> +    }
>>>> +    if (writefn == NULL) {
>>>> +        writefn = raw_write;
>>>> +    }
>>>> +    writefn(env, ri, value);
>>>> +}
>>>
>>> I see how this works when we have a readfn or writefn,
>>> but how does the redirection work where the access
>>> goes directly via .fieldoffset ?
>>
>> When there is no .writefn, we use raw_write, which uses fieldoffset.
> 
> Yes, that's what I mean. There's no 'if redirect then this
> fieldoffset else that fieldoffset' codepath, so how does
> it update the right field?

Oh, for the redirected system registers, there will *always* be a .writefn --
el2_e2h_write.  What there will not necessarily be is a .orig_writefn -- in
which case we'll use raw_write.


r~




reply via email to

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