Resent-Date: Wed, 28 Jul 1999 18:53:56 +0200 (MET DST)
Date: Wed, 28 Jul 1999 18:53:40 +0200 (MET DST)
From: Roman Zippel <zippel@fh-brandenburg.de>
X-Sender: zippel@zeus
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>
Subject: mm fix
Resent-From: linux-m68k@phil.uni-sb.de

Hi,

Here is the final fix for the memory menagement system, that's the last
one I promise! There can't be any bug anymore. ;-)
Anyway, I wonder that this bug wasn't triggered before, for the 020/030 we
forgot to protect the pointer table, that we used to unmap the zero page.
The patch is needed for 2.2 and 2.3.

bye, Roman

--- linux/arch/m68k/mm/init.c	1999/07/26 11:42:59	1.1.1.1
+++ linux/arch/m68k/mm/init.c	1999/07/28 16:34:16
@@ -139,6 +137,7 @@
 }
 
 static pmd_t *last_pgtable __initdata = NULL;
+static pmd_t *zero_pgtable __initdata = NULL;
 
 __initfunc(static pmd_t * kernel_ptr_table(unsigned long *memavailp))
 {
@@ -236,7 +235,8 @@
 #ifdef DEBUG
 				printk ("[zero map]");
 #endif
-				pte_dir = (pte_t *)kernel_ptr_table(memavailp);
+				zero_pgtable = kernel_ptr_table(memavailp);
+				pte_dir = (pte_t *)zero_pgtable;
 				pmd_dir->pmd[0] = virt_to_phys(pte_dir) |
 					_PAGE_TABLE | _PAGE_ACCESSED;
 				pte_val(*pte_dir++) = 0;
@@ -450,6 +450,9 @@
 		if (pgd_present(kernel_pg_dir[i]))
 			init_pointer_table(pgd_page(kernel_pg_dir[i]));
 	}
+	/* insert also page table, that we did use to unmap zero page on 0[23]0 */
+	if (zero_pgtable)
+		init_pointer_table((unsigned long)zero_pgtable);
 
 	printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
 	       (unsigned long) nr_free_pages << (PAGE_SHIFT-10),

