[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-tab
From: |
Edgar E. Iglesias |
Subject: |
Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-table protection bits |
Date: |
Thu, 1 Oct 2015 12:52:38 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Oct 01, 2015 at 08:48:17PM +0100, Peter Maydell wrote:
> On 1 October 2015 at 19:44, Edgar E. Iglesias <address@hidden> wrote:
> > On Wed, Sep 23, 2015 at 09:55:05AM -0700, Peter Maydell wrote:
> >> This isn't right -- the XN bit controls executability and the
> >> S2AP bits don't affect it at all. I think you want:
> >>
> >> int prot_rw = 0;
> >> if (s2ap & 1) {
> >> prot_rw |= PAGE_READ;
> >> }
> >> if (s2ap & 2) {
> >> prot_rw |= PAGE_WRITE;
> >> }
> >> if (!xn) {
> >> prot_rw |= PAGE_EXEC;
> >> }
> >
> >
> > Thanks, this was the stuff I was worried about when we talked about it
> > last time. I've got the following now which seems to be the same as
> > you suggest:
> >
> > static int get_S2prot(CPUARMState *env, int s2ap, int xn)
> > {
> > int prot;
> >
> > prot = s2ap & 1 ? PAGE_READ : 0;
> > prot |= s2ap & 2 ? PAGE_WRITE : 0;
> > if (!xn) {
> > prot |= PAGE_EXEC;
> > }
> > return prot;
> > }
>
> Yep, that's the right logic, though it seems a bit odd not
> to consistently use either 'if' or '?:' for all 3 bits.
OK, that's true, I'll change it to all ifs.
Thanks,
Edgar