|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] symbols: split symbols_num_syms
commit 16d9721613a05c3af26721d0a3552046bc31671f
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Sep 1 11:07:49 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 1 13:06:47 2025 +0200
symbols: split symbols_num_syms
In preparation for inserting address entries into symbols_addresses[] /
symbols_offsets[] without enlarging symbols_sorted_offsets[], split
symbols_num_syms into symbols_num_addrs (counting entries in the former
plus symbols_names[] as well as, less directly, symbols_markers[]) and
symbols_num_names (counting entries in the latter).
While doing the adjustment move declarations to a new private symbols.h,
to be used by both symbols.c and symbols-dummy.c. Replace u8/u16 while
doing so.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
xen/common/symbols-dummy.c | 12 ++++++------
xen/common/symbols.c | 28 ++++++----------------------
xen/common/symbols.h | 36 ++++++++++++++++++++++++++++++++++++
xen/tools/symbols.c | 6 +++++-
4 files changed, 53 insertions(+), 29 deletions(-)
diff --git a/xen/common/symbols-dummy.c b/xen/common/symbols-dummy.c
index 03cf623d69..57817c504b 100644
--- a/xen/common/symbols-dummy.c
+++ b/xen/common/symbols-dummy.c
@@ -3,22 +3,22 @@
* link of the hypervisor image.
*/
-#include <xen/types.h>
-#include <xen/symbols.h>
+#include "symbols.h"
#ifdef SYMBOLS_ORIGIN
const unsigned int symbols_offsets[1];
#else
const unsigned long symbols_addresses[1];
#endif
-const unsigned int symbols_num_syms;
-const u8 symbols_names[1];
+const unsigned int symbols_num_addrs;
+const unsigned char symbols_names[1];
#ifdef CONFIG_FAST_SYMBOL_LOOKUP
+const unsigned int symbols_num_names;
const struct symbol_offset symbols_sorted_offsets[1];
#endif
-const u8 symbols_token_table[1];
-const u16 symbols_token_index[1];
+const uint8_t symbols_token_table[1];
+const uint16_t symbols_token_index[1];
const unsigned int symbols_markers[1];
diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index 1bc7ce7e05..500d726325 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -10,7 +10,6 @@
* compression (see tools/symbols.c for a more complete description)
*/
-#include <xen/symbols.h>
#include <xen/kernel.h>
#include <xen/init.h>
#include <xen/lib.h>
@@ -21,22 +20,7 @@
#include <xen/guest_access.h>
#include <xen/errno.h>
-#ifdef SYMBOLS_ORIGIN
-extern const unsigned int symbols_offsets[];
-#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
-#else
-extern const unsigned long symbols_addresses[];
-#define symbols_address(n) symbols_addresses[n]
-#endif
-extern const unsigned int symbols_num_syms;
-extern const u8 symbols_names[];
-
-extern const struct symbol_offset symbols_sorted_offsets[];
-
-extern const u8 symbols_token_table[];
-extern const u16 symbols_token_index[];
-
-extern const unsigned int symbols_markers[];
+#include "symbols.h"
/* expand a compressed symbol data into the resulting uncompressed string,
given the offset to where the symbol is in the compressed stream */
@@ -124,7 +108,7 @@ const char *symbols_lookup(unsigned long addr,
/* do a binary search on the sorted symbols_addresses array */
low = 0;
- high = symbols_num_syms;
+ high = symbols_num_addrs;
while (high-low > 1) {
mid = (low + high) / 2;
@@ -141,7 +125,7 @@ const char *symbols_lookup(unsigned long addr,
symbols_expand_symbol(get_symbol_offset(low), namebuf);
/* Search for next non-aliased symbol */
- for (i = low + 1; i < symbols_num_syms; i++) {
+ for (i = low + 1; i < symbols_num_addrs; i++) {
if (symbols_address(i) > symbols_address(low)) {
symbol_end = symbols_address(i);
break;
@@ -182,9 +166,9 @@ int xensyms_read(uint32_t *symnum, char *type,
static unsigned int next_symbol, next_offset;
static DEFINE_SPINLOCK(symbols_mutex);
- if ( *symnum > symbols_num_syms )
+ if ( *symnum > symbols_num_addrs )
return -ERANGE;
- if ( *symnum == symbols_num_syms )
+ if ( *symnum == symbols_num_addrs )
{
/* No more symbols */
name[0] = '\0';
@@ -227,7 +211,7 @@ unsigned long symbols_lookup_by_name(const char *symname)
#ifdef CONFIG_FAST_SYMBOL_LOOKUP
low = 0;
- high = symbols_num_syms;
+ high = symbols_num_names;
while ( low < high )
{
unsigned long mid = low + ((high - low) / 2);
diff --git a/xen/common/symbols.h b/xen/common/symbols.h
new file mode 100644
index 0000000000..a993f41c21
--- /dev/null
+++ b/xen/common/symbols.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef SYMBOLS_H
+#define SYMBOLS_H
+
+#include <xen/stdint.h>
+#include <xen/symbols.h>
+
+#ifdef SYMBOLS_ORIGIN
+extern const unsigned int symbols_offsets[];
+#define symbols_address(n) (SYMBOLS_ORIGIN + symbols_offsets[n])
+#else
+extern const unsigned long symbols_addresses[];
+#define symbols_address(n) symbols_addresses[n]
+#endif
+extern const unsigned int symbols_num_addrs;
+extern const unsigned char symbols_names[];
+
+extern const unsigned int symbols_num_names;
+extern const struct symbol_offset symbols_sorted_offsets[];
+
+extern const uint8_t symbols_token_table[];
+extern const uint16_t symbols_token_index[];
+
+extern const unsigned int symbols_markers[];
+
+#endif /* SYMBOLS_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index dbf441c6ea..d2d5e1bc83 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -323,7 +323,7 @@ static void write_src(void)
}
printf("\n");
- output_label("symbols_num_syms");
+ output_label("symbols_num_addrs");
printf("\t.long\t%d\n", table_cnt);
printf("\n");
@@ -373,6 +373,10 @@ static void write_src(void)
return;
}
+ output_label("symbols_num_names");
+ printf("\t.long\t%d\n", table_cnt);
+ printf("\n");
+
/* Sorted by original symbol names and type. */
qsort(table, table_cnt, sizeof(*table), compare_name_orig);
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |