Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Matthew Wilcox <Matthew.Wilcox@genedata.com>
To: parisc-linux@thepuffingroup.com
Subject: [parisc-linux] pgtable.h:acc_rights()
Date: Sat, 6 Nov 1999 17:20:23 +0100	[thread overview]
Message-ID: <19991106172023.L25252@mencheca.ch.genedata.com> (raw)


Why is acc_rights written like this?

#define acc_rights(pte)       \
        (((pte) & _PAGE_EXEC) ? \
                (((pte) & _PAGE_RW) ? \
                        acc_r(3,acc_pl(pte),acc_pl(pte)) : \
                        acc_r(3,acc_pl(pte),acc_pl(pte))) : \
                (((pte) & _PAGE_RW) ? \
                        acc_r(1,acc_pl(pte),acc_pl(pte)) : \
                        acc_r(1,acc_pl(pte),acc_pl(pte))))

According to the PA-1.1 Architecture manual I have here, if the page isn't
writable, the MSB should be clear, like so:

#define acc_rights(pte)       \
        (((pte) & _PAGE_EXEC) ? \
                (((pte) & _PAGE_RW) ? \
                        acc_r(3,acc_pl(pte),acc_pl(pte)) : \
                        acc_r(2,acc_pl(pte),acc_pl(pte))) : \
                (((pte) & _PAGE_RW) ? \
                        acc_r(1,acc_pl(pte),acc_pl(pte)) : \
                        acc_r(0,acc_pl(pte),acc_pl(pte))))

of course, it should be rewritten to look much cleaner.  In fact,
by renumbering the bits, we could get that for free (as long as we put
a big fat warning above the #defines of _PAGE_* to warn that the
constants are in that order for hardware efficiency).
              
Anyway, I'm after a spare bit in the pte for _PAGE_GATEWAY.  As I
understand it (from the mk_pte() macro), there are 12 bits available,
only 8 of which are used, so I can nobble one of them to mark a page
as being a gateway, right?

-- 
Matthew Wilcox <willy@bofh.ai>
"Windows and MacOS are products, contrived by engineers in the service of
specific companies. Unix, by contrast, is not so much a product as it is a
painstakingly compiled oral history of the hacker subculture." - N Stephenson

             reply	other threads:[~1999-11-06 16:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-06 16:20 Matthew Wilcox [this message]
1999-11-06 19:51 ` [parisc-linux] pgtable.h:acc_rights() Philipp Rumpf
1999-11-06 20:48   ` Thomas Bogendoerfer
1999-11-07 13:02     ` Philipp Rumpf

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=19991106172023.L25252@mencheca.ch.genedata.com \
    --to=matthew.wilcox@genedata.com \
    --cc=parisc-linux@thepuffingroup.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox