
Date: Thu, 2 Feb 2012 09:06:23 +0900
Subject: [PATCH 1/4] ppc: change from define value to variable

PGDIR_SHIFT, PTRS_PER_PTE, and PTRS_PER_PGD values are depend on
PowerPC 32bit target platform.
Change them to int value and set existing values as defaults.

[Todo]
Learned this approach from x86.c.
However, since these defines are also provided as devel package,
not static, extern them now (or announce disappearing).

Signed-off-by: Toshikazu Nakayama <nakayama.ts@ncos.nec.co.jp>
---
 defs.h |   10 +++++++---
 ppc.c  |    4 ++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/defs.h b/defs.h
index 82d51e5..b64e886 100755
--- a/defs.h
+++ b/defs.h
@@ -2603,9 +2603,13 @@ struct load_module {
 #define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
 #define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
 
-#define PGDIR_SHIFT   (22)
-#define PTRS_PER_PTE  (1024)
-#define PTRS_PER_PGD  (1024)
+extern int PGDIR_SHIFT;
+extern int PTRS_PER_PTE;
+extern int PTRS_PER_PGD;
+/* ppc32's default page table format */
+#define PGDIR_SHIFT_DEFAULT	(22)
+#define PTRS_PER_PTE_DEFAULT	(1024)
+#define PTRS_PER_PGD_DEFAULT	(1024)
 
 #define _PAGE_PRESENT   0x001   /* software: pte contains a translation */
 #define _PAGE_USER      0x002   /* matches one of the PP bits */
diff --git a/ppc.c b/ppc.c
index a6e67fd..52d665d 100755
--- a/ppc.c
+++ b/ppc.c
@@ -69,6 +69,10 @@ static void ppc_display_machine_stats(void);
 static void ppc_dump_line_number(ulong);
 static struct line_number_hook ppc_line_number_hooks[];
 
+int PGDIR_SHIFT = PGDIR_SHIFT_DEFAULT;
+int PTRS_PER_PTE = PTRS_PER_PTE_DEFAULT;
+int PTRS_PER_PGD = PTRS_PER_PGD_DEFAULT;
+
 /*
  *  Do all necessary machine-specific setup here.  This is called twice,
  *  before and after GDB has been initialized.
-- 
1.7.8.163.g9859a


