Resent-Date: Fri, 20 Nov 1998 11:57:31 +0100 (MET)
To: richard@sleepie.demon.co.uk
Cc: linux-m68k@lists.linux-m68k.org
Subject: Re: mk_pte_phys()
References: <360F9C83.FFFF4C42@net-tel.co.uk>
From: Jes Sorensen <Jes.Sorensen@cern.ch>
Date: 20 Nov 1998 11:56:55 +0100
In-Reply-To: Richard Hirst's message of "Mon, 28 Sep 1998 15:26:11 +0100"
Resent-From: linux-m68k@phil.uni-sb.de

>>>>> "Richard" == Richard Hirst <richard.hirst@net-tel.co.uk> writes:

Richard> Hi, asm/pgtable.h has mk_pte() and mk_pte_phys() defined to
Richard> both call VTOP() on the address.  I think mk_pte_phys()
Richard> should be passed a physical address anyway, and therefore
Richard> shouldn't call VTOP().  It gets used in remap_page_range(),
Richard> and causes me problems if a user process does an mmap() on a
Richard> chunk on /dev/memnc to access some range of VME address
Richard> space.  There are no kernel mmu tables for the vme address
Richard> space so mm_vtop() fails.

You are damn right, why don't I just listen to you and fix things
before they start biting everybody?

Anyway this was actually what caused X to fail with 2.1.127+. mmap()
hangs forever on the 040/060 when you try to map unmapped memory and
if you map the Z2 area it blows up.

People who wants to run X with the latest kernel probably wants to
apply this patch.

Thanks a lot for pointing this out.

Jes

--- /var/tmp/native-2.1.128/include/asm-m68k/pgtable.h	Wed Sep  2 16:39:18 1998
+++ linux/include/asm-m68k/pgtable.h	Fri Nov 20 11:12:53 1998
@@ -428,7 +428,7 @@
 #define mk_pte(page, pgprot) \
 ({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)page) + pgprot_val(pgprot); __pte; })
 #define mk_pte_phys(physpage, pgprot) \
-({ pte_t __pte; pte_val(__pte) = virt_to_phys((void *)physpage) + pgprot_val(pgprot); __pte; })
+({ pte_t __pte; pte_val(__pte) = (unsigned long)physpage + pgprot_val(pgprot); __pte; })
 
 extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 { pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; }

