Resent-Date: Fri, 29 Jan 1999 10:11:12 +0100 (MET)
To: Kars de Jong <jongk@cs.utwente.nl>
Cc: linux-m68k@lists.linux-m68k.org
Subject: Re: X problems in 2.2.0pre
References: <d3d8413pc0.fsf@valhall.cern.ch> <19990127192209.A2172@cs.utwente.nl> <d3lniozeo2.fsf@valhall.cern.ch> <19990128150206.B284@rincewind.discworld.org> <d3aez31mpe.fsf@valhall.cern.ch> <19990128195801.A155@rincewind.discworld.org> <d3yamnz0dp.fsf@valhall.cern.ch> <19990128222602.A150@rincewind.discworld.org> <d3vhhqzds9.fsf@valhall.cern.ch>
From: Jes Sorensen <Jes.Sorensen@cern.ch>
Date: 29 Jan 1999 10:10:54 +0100
In-Reply-To: Jes Sorensen's message of "29 Jan 1999 09:25:26 +0100"
Resent-From: linux-m68k@phil.uni-sb.de

>>>>> "Jes" == Jes Sorensen <Jes.Sorensen@cern.ch> writes:

>>>>> "Kars" == Kars de Jong <jongk@cs.utwente.nl> writes:
Kars> Note that I print the case (0 || 0) now as well...  The
Kars> corruption probably occurs in the (0 || 0) case.  There is no
Kars> difference between the plain pre7 and the one with Jes' patch.
Kars> So apparently some other code clears the PG_reserved bit for
Kars> some pages...

Jes> Right, now to go find the offender ....

It seems that my original patch tried to mark the reserved bit for
physical mappings instead of the virtual mappings for the Z2
area. Could you try this one instead.

Now where did I leave that brown paper bag?

Jes

--- /data/tmp/linux-2.2.0pre7/arch/m68k/mm/init.c	Mon Jan 18 15:06:52 1999
+++ linux/arch/m68k/mm/init.c	Fri Jan 29 09:58:50 1999
@@ -392,6 +392,20 @@
 	return PAGE_ALIGN(free_area_init(start_mem, end_mem));
 }
 
+#ifdef CONFIG_AMIGA
+void __init reserve_z2_ram(void)
+{
+#define Z2_SIZE		16*1024*1024
+
+	unsigned long z2addr = zTwoBase;
+
+	mem_map_t *mapp = &mem_map[MAP_NR(z2addr)];
+
+	for( ; z2addr < zTwoBase+Z2_SIZE; z2addr += PAGE_SIZE, ++mapp )
+		set_bit( PG_reserved, &mapp->flags );
+}
+#endif
+
 void __init mem_init(unsigned long start_mem, unsigned long end_mem)
 {
 	int codepages = 0;
@@ -403,6 +417,11 @@
 	end_mem &= PAGE_MASK;
 	high_memory = (void *) end_mem;
 	max_mapnr = num_physpages = MAP_NR(end_mem);
+
+#ifdef CONFIG_AMIGA
+	if (MACH_IS_AMIGA)
+		reserve_z2_ram();
+#endif
 
 	tmp = start_mem = PAGE_ALIGN(start_mem);
 	while (tmp < end_mem) {

