Linux PARISC architecture development
 help / color / mirror / Atom feed
* [parisc-linux] pgtable.h:acc_rights()
@ 1999-11-06 16:20 Matthew Wilcox
  1999-11-06 19:51 ` Philipp Rumpf
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 1999-11-06 16:20 UTC (permalink / raw)
  To: parisc-linux


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-11-07 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-11-06 16:20 [parisc-linux] pgtable.h:acc_rights() Matthew Wilcox
1999-11-06 19:51 ` Philipp Rumpf
1999-11-06 20:48   ` Thomas Bogendoerfer
1999-11-07 13:02     ` Philipp Rumpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox