----- Original Message -----
Thanks to kernel commit 9d372c9fab34 "arm64: Add page size to
the
kernel image header", we don't need a heuristic to determine the
pagesize on arm64. Keep the heuristic for older kernels, but try
reading the header first.
---
arm64.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arm64.c b/arm64.c
index 8cfb863d1bfe2..6187b96d25a4d 100644
--- a/arm64.c
+++ b/arm64.c
@@ -19,6 +19,7 @@
#include "defs.h"
#include <elf.h>
+#include <endian.h>
#define NOT_IMPLEMENTED(X) error((X), "%s: function not implemented\n",
__func__)
@@ -98,6 +99,35 @@ arm64_init(int when)
case PRE_GDB:
if (!machdep->pagesize &&
+ kernel_symbol_exists("_kernel_flags_le")) {
+
+ /*
+ * Kerneldoc Documentation/arm64/booting.txt describes
+ * the kernel image header flags field.
+ */
+
+ value = le64toh(symbol_value("_kernel_flags_le"));
+ value = (value >> 1) & 3;
+
+ switch(value)
+ {
+ case 0:
+ break;
+ case 1:
+ machdep->pagesize = 4096;
+ break;
+ case 2:
+ /* TODO: machdep->pagesize = 16384; */
+ error(FATAL, "16K pages not supported.");
+ break;
+ case 3:
+ machdep->pagesize = 65536;
+ break;
+ }
+
+ }
+
+ if (!machdep->pagesize &&
kernel_symbol_exists("swapper_pg_dir") &&
kernel_symbol_exists("idmap_pg_dir")) {
value = symbol_value("swapper_pg_dir") -
--
2.4.3
So yeah, let's not keep "_kernel_flags_le" as a kernel symbol, but stash
it aside as a variable, say in the arm64_machine_specific structure, so that
it can be displayed later by arm64_dump_machdep_table().
Dave