All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Oom <other+qemudev@hoko.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ARM MMU translation - fix small (4k) page access
Date: Fri, 02 Feb 2007 13:33:12 -0500	[thread overview]
Message-ID: <45C383E8.3040907@hoko.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0702020951190.2647@buttercup.gerph.org>

Justin Fletcher wrote:
> 
> I may be confused on this, but it still doesn't seem right to me.
> 
> You have...
> 
> -                ap = (desc >> (4 + ((address >> 13) & 6))) & 3;
> +                ap = (desc >> (4 + ((address >> 11) & 6))) & 3; /* SRO */
> 
> For 4K pages, the L2 table is ...
>   b0-1 = 2
>   b2   = B
>   b3   = C
>   b4-5 = AP0
>   b6-7 = AP1
>   b8-9 = AP2
>   b10-11=AP3
>   b12-31=physical address
> (from ARMARM 'D', 3.3.7)
> 
> The use of AP0-AP3 is dependant on bits 10 and 11. So, the code should
> be more like...
> 
>                 ap = (desc >> (4 + ((address >> 10) & 3) )) & 3;
> 
> That is, (address>>10) & 3 => bits 10 and 11
>          add on 4 as the offset to the AP fields in the descriptor
>          shift down and & 3 to leave just those two bits.
> 
Well, we need to take b10-11 and use them to index either 4-5, 6-7, 8-9
or 10-11.
(address >> 10) & 3 gives us 0, 1, 2 or 3, shift that left one to double
it (because each AP field is two bits).  Adding 4 gives 4, 6, 8, 10.  So
I believe the correct solution is:
                ap = (desc >> (4 + ((address >> 9) & 6))) & 3;

I thought if was just 2 bits different from the large page descriptor,
but the difference, the SBZ field, is 4 bits.  Comparing to the large
page descriptor:
                ap = (desc >> (4 + ((address >> 13) & 6))) & 3;


-Scott

      parent reply	other threads:[~2007-02-02 18:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-02  5:20 [Qemu-devel] [PATCH] ARM MMU translation - fix small (4k) page access Scott Oom
2007-02-02  9:58 ` Justin Fletcher
2007-02-02 17:48   ` Justin Fletcher
2007-02-02 18:33   ` Scott Oom [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45C383E8.3040907@hoko.org \
    --to=other+qemudev@hoko.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.