Resent-Date: Mon, 2 Aug 1999 10:30:54 +0200 (MET DST)
From: zippel@fh-brandenburg.de (Roman Zippel)
Subject: Re: mm fix
To: zippel@fh-brandenburg.de (Roman Zippel)
Date: Mon, 2 Aug 1999 10:30:51 +0200 (MET DST)
Cc: linux-m68k@lists.linux-m68k.org
In-Reply-To: <Pine.GSO.3.96.990728184057.1113A-100000@zeus> from "Roman Zippel" at Jul 28, 99 06:53:40 pm
Resent-From: linux-m68k@phil.uni-sb.de

Hi,

> 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.

Argh, when fixing this, I shouldn't break other cpus of course...

bye, Roman

--- arch/m68k/mm/init.c	1999/05/12 23:57:02	1.1.1.2
+++ arch/m68k/mm/init.c	1999/08/01 22:55:14
@@ -139,6 +139,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 +237,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 +452,9 @@
 		if (pgd_present(kernel_pg_dir[i]))
 			init_pointer_table(pgd_page(kernel_pg_dir[i]));
 	}
+	/* insert also pointer table that we used to unmap the zero page */
+	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),

