On Wed, Sep 06, 2000 at 02:30:05PM -0700, Jun Sun wrote:
> In MIPS, mk_pte_phys() is defined as follows :
> extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
> return __pte(((physpage & PAGE_MASK) - PAGE_OFFSET) |
> The problematic part is " - PAGE_OFFSET" (where PAGE_OFFSET is
> 0x80000000). If "physpage" is a physical address, it should not be
> substracted by PAGE_OFFSET. This is a bug.
> On the other hand, I wonder why this bug is there without being caught
> before (it is so fundamental). If this is not a bug in MIPS kernel,
> then the fix is in the fb_mmap(), where under __mips__ case, we should
> add PAGE_OFFSET to the start of buffer address.
The definition should be:
extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
return __pte(physpage) | pgprot_val(pgprot);
Masking with PAGE_MASK also seemed to be useless.
It's really surprising why it never has been caught. Probably people
feed it with the addresses that are tweaked such that sich just work.
I'll cook up a patch for this bug.