In Xen4, init_tss is a per-cpu symbol. Without this patch, crash fails
on Xen4 hypervisor dumps during initialization with
'crash: cannot resolve "init_tss"'.
Signed-off-by: Petr Tesarik <ptesarik(a)suse.cz>
---
xen_hyper.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
--- a/xen_hyper.c
+++ b/xen_hyper.c
@@ -319,6 +319,7 @@ xen_hyper_x86_pcpu_init(void)
struct xen_hyper_pcpu_context *pcc;
char *buf, *bp;
int i, cpuid;
+ int flag;
XEN_HYPER_MEMBER_OFFSET_INIT(cpu_info_guest_cpu_user_regs, "cpu_info",
"guest_cpu_user_regs");
XEN_HYPER_MEMBER_OFFSET_INIT(cpu_info_processor_id, "cpu_info",
"processor_id");
@@ -330,11 +331,21 @@ xen_hyper_x86_pcpu_init(void)
/* get physical cpu context */
xen_hyper_alloc_pcpu_context_space(XEN_HYPER_MAX_CPUS());
- init_tss_base = symbol_value("init_tss");
+ if (symbol_exists("per_cpu__init_tss")) {
+ init_tss_base = symbol_value("per_cpu__init_tss");
+ flag = TRUE;
+ } else {
+ init_tss_base = symbol_value("init_tss");
+ flag = FALSE;
+ }
buf = GETBUF(XEN_HYPER_SIZE(tss_struct));
for_cpu_indexes(i, cpuid)
{
- init_tss = init_tss_base + XEN_HYPER_SIZE(tss_struct) * cpuid;
+ if (flag)
+ init_tss = xen_hyper_per_cpu(init_tss_base, cpuid);
+ else
+ init_tss = init_tss_base +
+ XEN_HYPER_SIZE(tss_struct) * cpuid;
if (!readmem(init_tss, KVADDR, buf,
XEN_HYPER_SIZE(tss_struct), "init_tss", RETURN_ON_ERROR)) {
error(FATAL, "cannot read init_tss.\n");