diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-07-13 16:49:50 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-07-13 16:49:50 +0100 |
commit | 700ac7a490b46d5ddc1e730c971bc6f7ec9d70ca (patch) | |
tree | ad615e88a92df6b57a99eaaf83b53fe7f619f4cd /xen/common/symbols.c | |
parent | b37d30c8fc5226203f5bb71fe79789cd8545f09b (diff) | |
download | xen-700ac7a490b46d5ddc1e730c971bc6f7ec9d70ca.tar.gz xen-700ac7a490b46d5ddc1e730c971bc6f7ec9d70ca.tar.bz2 xen-700ac7a490b46d5ddc1e730c971bc6f7ec9d70ca.zip |
x86-64: reduce symbol table size
With all of Xen's symbols sitting within a 2Gb range on x86-64, they
can be referred to by the kallsyms-like offset table using 4- instead
of 8-byte slots.
The marker table can use 4-byte slots in all cases, just like the
table entry counts can (though that's only a minor improvement).
If ia64's PERCPU_ADDR got moved down to (KERNEL_START + 2Gb -
PERCPU_PAGE_SIZE), it could also utilize the more compact form.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/common/symbols.c')
-rw-r--r-- | xen/common/symbols.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/xen/common/symbols.c b/xen/common/symbols.c index 60f3c335a6..4054ba01cc 100644 --- a/xen/common/symbols.c +++ b/xen/common/symbols.c @@ -18,21 +18,27 @@ #include <xen/string.h> #include <xen/spinlock.h> -extern unsigned long symbols_addresses[]; -extern unsigned long symbols_num_syms; -extern u8 symbols_names[]; +#ifdef SYMBOLS_ORIGIN +extern const unsigned int symbols_offsets[1]; +#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 u8 symbols_token_table[]; -extern u16 symbols_token_index[]; +extern const u8 symbols_token_table[]; +extern const u16 symbols_token_index[]; -extern unsigned long symbols_markers[]; +extern const unsigned int symbols_markers[]; /* expand a compressed symbol data into the resulting uncompressed string, given the offset to where the symbol is in the compressed stream */ static unsigned int symbols_expand_symbol(unsigned int off, char *result) { int len, skipped_first = 0; - u8 *tptr, *data; + const u8 *tptr, *data; /* get the compressed symbol length from the first symbol byte */ data = &symbols_names[off]; @@ -70,7 +76,7 @@ static unsigned int symbols_expand_symbol(unsigned int off, char *result) * symbols array */ static unsigned int get_symbol_offset(unsigned long pos) { - u8 *name; + const u8 *name; int i; /* use the closest marker we have. We have markers every 256 positions, @@ -107,13 +113,13 @@ const char *symbols_lookup(unsigned long addr, while (high-low > 1) { mid = (low + high) / 2; - if (symbols_addresses[mid] <= addr) low = mid; + if (symbols_address(mid) <= addr) low = mid; else high = mid; } /* search for the first aliased symbol. Aliased symbols are symbols with the same address */ - while (low && symbols_addresses[low - 1] == symbols_addresses[low]) + while (low && symbols_address(low - 1) == symbols_address(low)) --low; /* Grab name */ @@ -121,8 +127,8 @@ const char *symbols_lookup(unsigned long addr, /* Search for next non-aliased symbol */ for (i = low + 1; i < symbols_num_syms; i++) { - if (symbols_addresses[i] > symbols_addresses[low]) { - symbol_end = symbols_addresses[i]; + if (symbols_address(i) > symbols_address(low)) { + symbol_end = symbols_address(i); break; } } @@ -132,8 +138,8 @@ const char *symbols_lookup(unsigned long addr, symbol_end = is_kernel_inittext(addr) ? (unsigned long)_einittext : (unsigned long)_etext; - *symbolsize = symbol_end - symbols_addresses[low]; - *offset = addr - symbols_addresses[low]; + *symbolsize = symbol_end - symbols_address(low); + *offset = addr - symbols_address(low); return namebuf; } |