
From: "Martin J. Bligh" <mbligh@aracnet.com>

Badari hit a problem when configuring PAE off (ie CONFIG_4G) where the
pkmap area could end up overlapping the fixmap area.  For some reason,
PKMAP_BASE was defined statically, which seems rather pointless, and asking
for trouble.  Patch below definines it dynamically, under the fixmap area. 
The ordering of the VMALLOC_RESERVE space is:

FIXADDR_TOP
			fixed_addresses
FIXADDR_START
			temp fixed addresses
FIXADDR_BOOT_START
			Persistent kmap area
PKMAP_BASE
VMALLOC_END
			Vmalloc area
VMALLOC_START
high_memory


Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/asm-i386/fixmap.h  |    4 +++-
 25-akpm/include/asm-i386/highmem.h |   21 ++++++++++++++++-----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff -puN include/asm-i386/fixmap.h~assign-pkmap_base-dynamically include/asm-i386/fixmap.h
--- 25/include/asm-i386/fixmap.h~assign-pkmap_base-dynamically	Mon Nov 22 14:35:25 2004
+++ 25-akpm/include/asm-i386/fixmap.h	Mon Nov 22 14:35:25 2004
@@ -109,7 +109,9 @@ extern void __set_fixmap (enum fixed_add
 #define FIXADDR_TOP	((unsigned long)__FIXADDR_TOP)
 
 #define __FIXADDR_SIZE	(__end_of_permanent_fixed_addresses << PAGE_SHIFT)
-#define FIXADDR_START	(FIXADDR_TOP - __FIXADDR_SIZE)
+#define __FIXADDR_BOOT_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
+#define FIXADDR_START		(FIXADDR_TOP - __FIXADDR_SIZE)
+#define FIXADDR_BOOT_START	(FIXADDR_TOP - __FIXADDR_BOOT_SIZE)
 
 #define __fix_to_virt(x)	(FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x)	((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
diff -puN include/asm-i386/highmem.h~assign-pkmap_base-dynamically include/asm-i386/highmem.h
--- 25/include/asm-i386/highmem.h~assign-pkmap_base-dynamically	Mon Nov 22 14:35:25 2004
+++ 25-akpm/include/asm-i386/highmem.h	Mon Nov 22 14:35:25 2004
@@ -40,16 +40,27 @@ extern void kmap_init(void);
  * easily, subsequent pte tables have to be allocated in one physical
  * chunk of RAM.
  */
-#if NR_CPUS <= 32
-#define PKMAP_BASE (0xff800000UL)
-#else
-#define PKMAP_BASE (0xff600000UL)
-#endif
 #ifdef CONFIG_X86_PAE
 #define LAST_PKMAP 512
 #else
 #define LAST_PKMAP 1024
 #endif
+/*
+ * Ordering is:
+ *
+ * FIXADDR_TOP
+ * 			fixed_addresses
+ * FIXADDR_START
+ * 			temp fixed addresses
+ * FIXADDR_BOOT_START
+ * 			Persistent kmap area
+ * PKMAP_BASE
+ * VMALLOC_END
+ * 			Vmalloc area
+ * VMALLOC_START
+ * high_memory
+ */
+#define PKMAP_BASE ( (FIXADDR_BOOT_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK )
 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
_
