98 lines
2.9 KiB
Diff
98 lines
2.9 KiB
Diff
|
|
From 67d0e1d68f28c567a704fd6b9b8fd696ad3df183 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||
|
|
Date: Fri, 29 Jan 2021 11:40:24 +0900
|
||
|
|
Subject: [PATCH] [PATCH 2/3] arm64: Make use of NUMBER(VA_BITS) in vmcoreinfo
|
||
|
|
|
||
|
|
Make use of the NUMBER(VA_BITS) in vmcoreinfo, which was added by
|
||
|
|
kernel commit 20a166243328 (Linux 4.12 and later kernels), as the
|
||
|
|
current way of guessing VA_BITS does not work on Linux 5.4 and
|
||
|
|
later kernels.
|
||
|
|
|
||
|
|
Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
|
||
|
|
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
|
||
|
|
---
|
||
|
|
arch/arm64.c | 63 ++++++++++++++++++++++++++++++++++------------------
|
||
|
|
1 file changed, 42 insertions(+), 21 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/arch/arm64.c b/arch/arm64.c
|
||
|
|
index 3d7b416..2916b4f 100644
|
||
|
|
--- a/makedumpfile-1.6.7/arch/arm64.c
|
||
|
|
+++ b/makedumpfile-1.6.7/arch/arm64.c
|
||
|
|
@@ -345,6 +345,43 @@ get_stext_symbol(void)
|
||
|
|
return(found ? kallsym : FALSE);
|
||
|
|
}
|
||
|
|
|
||
|
|
+static int
|
||
|
|
+get_va_bits_from_stext_arm64(void)
|
||
|
|
+{
|
||
|
|
+ ulong _stext;
|
||
|
|
+
|
||
|
|
+ _stext = get_stext_symbol();
|
||
|
|
+ if (!_stext) {
|
||
|
|
+ ERRMSG("Can't get the symbol of _stext.\n");
|
||
|
|
+ return FALSE;
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
+ /*
|
||
|
|
+ * Derive va_bits as per arch/arm64/Kconfig. Note that this is a
|
||
|
|
+ * best case approximation at the moment, as there can be
|
||
|
|
+ * inconsistencies in this calculation (for e.g., for 52-bit
|
||
|
|
+ * kernel VA case, the 48th bit is set in * the _stext symbol).
|
||
|
|
+ */
|
||
|
|
+ if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) {
|
||
|
|
+ va_bits = 48;
|
||
|
|
+ } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) {
|
||
|
|
+ va_bits = 47;
|
||
|
|
+ } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) {
|
||
|
|
+ va_bits = 42;
|
||
|
|
+ } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) {
|
||
|
|
+ va_bits = 39;
|
||
|
|
+ } else if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) {
|
||
|
|
+ va_bits = 36;
|
||
|
|
+ } else {
|
||
|
|
+ ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n");
|
||
|
|
+ return FALSE;
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
+ DEBUG_MSG("va_bits : %d (guess from _stext)\n", va_bits);
|
||
|
|
+
|
||
|
|
+ return TRUE;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
int
|
||
|
|
get_machdep_info_arm64(void)
|
||
|
|
{
|
||
|
|
@@ -398,27 +435,11 @@ get_xen_info_arm64(void)
|
||
|
|
int
|
||
|
|
get_versiondep_info_arm64(void)
|
||
|
|
{
|
||
|
|
- ulong _stext;
|
||
|
|
-
|
||
|
|
- _stext = get_stext_symbol();
|
||
|
|
- if (!_stext) {
|
||
|
|
- ERRMSG("Can't get the symbol of _stext.\n");
|
||
|
|
- return FALSE;
|
||
|
|
- }
|
||
|
|
-
|
||
|
|
- /* Derive va_bits as per arch/arm64/Kconfig */
|
||
|
|
- if ((_stext & PAGE_OFFSET_36) == PAGE_OFFSET_36) {
|
||
|
|
- va_bits = 36;
|
||
|
|
- } else if ((_stext & PAGE_OFFSET_39) == PAGE_OFFSET_39) {
|
||
|
|
- va_bits = 39;
|
||
|
|
- } else if ((_stext & PAGE_OFFSET_42) == PAGE_OFFSET_42) {
|
||
|
|
- va_bits = 42;
|
||
|
|
- } else if ((_stext & PAGE_OFFSET_47) == PAGE_OFFSET_47) {
|
||
|
|
- va_bits = 47;
|
||
|
|
- } else if ((_stext & PAGE_OFFSET_48) == PAGE_OFFSET_48) {
|
||
|
|
- va_bits = 48;
|
||
|
|
- } else {
|
||
|
|
- ERRMSG("Cannot find a proper _stext for calculating VA_BITS\n");
|
||
|
|
+ if (NUMBER(VA_BITS) != NOT_FOUND_NUMBER) {
|
||
|
|
+ va_bits = NUMBER(VA_BITS);
|
||
|
|
+ DEBUG_MSG("va_bits : %d (vmcoreinfo)\n", va_bits);
|
||
|
|
+ } else if (get_va_bits_from_stext_arm64() == FALSE) {
|
||
|
|
+ ERRMSG("Can't determine va_bits.\n");
|
||
|
|
return FALSE;
|
||
|
|
}
|
||
|
|
|