Index: kernel.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/kernel.c,v retrieving revision 1.2 retrieving revision 1.2.2.2 diff -u -r1.2 -r1.2.2.2 --- kernel.c 5 Dec 2006 01:06:38 -0000 1.2 +++ kernel.c 8 Dec 2006 05:22:45 -0000 1.2.2.2 @@ -1416,7 +1416,9 @@ #ifdef XEN_HYPERVISOR_ARCH /* "task" means physical cpu id */ if (active) { - for (c = 0; c < xht->pcpus; c++) { + for (c = 0; c < XEN_HYPER_MAX_CPUS(); c++) { + if (!xen_hyper_test_pcpu_id(c)) + continue; fake_tc.task = c; BT_SETUP(&fake_tc); print_pcpu_header_hyper(fp, c, subsequent++); Index: lkcd_x86_trace.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/lkcd_x86_trace.c,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- lkcd_x86_trace.c 5 Dec 2006 01:06:38 -0000 1.2 +++ lkcd_x86_trace.c 14 Dec 2006 03:43:26 -0000 1.2.2.1 @@ -1554,8 +1554,8 @@ bp = curframe->fp + frame_size; } #endif - if ((func_name = kl_funcname(pc)) - && !XEN_HYPER_MODE()) { + func_name = kl_funcname(pc); + if (func_name && !XEN_HYPER_MODE()) { if (strstr(func_name, "kernel_thread")) { ra = 0; bp = saddr - 4; @@ -1678,6 +1678,26 @@ } else { return trace->nframes; } + } + } + if (func_name && XEN_HYPER_MODE()) { + if (STREQ(func_name, "continue_nmi")) { + /* Interrupt frame */ + sp = curframe->fp + 4; + asp = (uaddr_t*)((uaddr_t)sbp + (STACK_SIZE - + (saddr - sp))); + bp = curframe->fp + (12 * 4); + curframe = alloc_sframe(trace, flags); + ra = *(asp + 9); + UPDATE_FRAME(func_name, pc, ra, sp, bp + 4, asp, + 0, 0, curframe->fp - curframe->sp+4, 12 * 4); + + /* contunue next frame */ + pc = ra; + sp = curframe->fp + 4; + bp = sp + get_framesize(pc, bt); + func_name = kl_funcname(pc); + continue; } } Index: x86.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/x86.c,v retrieving revision 1.2 retrieving revision 1.2.2.2 diff -u -r1.2 -r1.2.2.2 --- x86.c 5 Dec 2006 01:06:38 -0000 1.2 +++ x86.c 8 Dec 2006 05:22:45 -0000 1.2.2.2 @@ -4718,7 +4718,7 @@ char *buf; /* task means pcpu here */ - if (task < 0 || task >= xht->pcpus) { + if (!xen_hyper_test_pcpu_id(task)) { error(FATAL, "invalid pcpu number\n"); } init_tss = symbol_value("init_tss"); @@ -4750,7 +4750,7 @@ /* task means pcpu here */ pcpu = bt->task; - if (pcpu < 0 || pcpu >= xht->pcpus) { + if (!xen_hyper_test_pcpu_id(pcpu)) { error(FATAL, "invalid pcpu number\n"); } @@ -4763,7 +4763,7 @@ return; } - regs = (ulong *)xhdit->context[pcpu].pr_reg_ptr; + regs = (ulong *)xen_hyper_id_to_dumpinfo_context(pcpu)->pr_reg_ptr; esp = XEN_HYPER_X86_NOTE_ESP(regs); eip = XEN_HYPER_X86_NOTE_EIP(regs); Index: x86_64.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/x86_64.c,v retrieving revision 1.2 retrieving revision 1.2.2.2 diff -u -r1.2 -r1.2.2.2 --- x86_64.c 5 Dec 2006 01:06:38 -0000 1.2 +++ x86_64.c 8 Dec 2006 05:22:45 -0000 1.2.2.2 @@ -4821,7 +4821,7 @@ char *buf; /* task means pcpu here */ - if (task < 0 || task >= xht->pcpus) { + if (!xen_hyper_test_pcpu_id(task)) { error(FATAL, "invalid pcpu number\n"); } init_tss = symbol_value("init_tss"); @@ -4853,7 +4853,7 @@ /* task means pcpu here */ pcpu = bt->task; - if (pcpu < 0 || pcpu >= xht->pcpus) { + if (!xen_hyper_test_pcpu_id(pcpu)) { error(FATAL, "invalid pcpu number\n"); } @@ -4866,7 +4866,7 @@ return; } - regs = (ulong *)xhdit->context[pcpu].pr_reg_ptr; + regs = (ulong *)xen_hyper_id_to_dumpinfo_context(pcpu)->pr_reg_ptr; rsp = XEN_HYPER_X86_64_NOTE_RSP(regs); rip = XEN_HYPER_X86_64_NOTE_RIP(regs); Index: xen_hyper.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper.c,v retrieving revision 1.1 retrieving revision 1.1.2.4 diff -u -r1.1 -r1.1.2.4 --- xen_hyper.c 5 Dec 2006 01:06:38 -0000 1.1 +++ xen_hyper.c 14 Dec 2006 00:03:41 -0000 1.1.2.4 @@ -36,20 +36,42 @@ get_symbol_data("crashing_cpu", sizeof(xht->crashing_cpu), &xht->crashing_cpu); - get_symbol_data("max_cpus", sizeof(xht->max_cpus), &xht->max_cpus); machdep->get_smp_cpus(); machdep->memory_size(); if (machine_type("X86") || machine_type("X86_64")) { member_offset = MEMBER_OFFSET("cpuinfo_x86", "x86_model_id"); buf = GETBUF(XEN_HYPER_SIZE(cpuinfo_x86)); - xen_hyper_fill_cpu_data_x86(0, buf); + xen_hyper_fill_cpu_data_x86(xht->crashing_cpu, buf); strncpy(xht->utsname.machine, (char *)(buf + member_offset), sizeof(xht->utsname.machine)-1); FREEBUF(buf); } XEN_HYPER_STRUCT_SIZE_INIT(note_buf_t, "note_buf_t"); + XEN_HYPER_STRUCT_SIZE_INIT(crash_note_t, "crash_note_t"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_t_core, "crash_note_t", "core"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_t_xen, "crash_note_t", "xen"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_t_xen_regs, "crash_note_t", "xen_regs"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_t_xen_info, "crash_note_t", "xen_info"); + + XEN_HYPER_STRUCT_SIZE_INIT(crash_note_core_t, "crash_note_core_t"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_core_t_note, "crash_note_core_t", "note"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_core_t_desc, "crash_note_core_t", "desc"); + + XEN_HYPER_STRUCT_SIZE_INIT(crash_note_xen_t, "crash_note_xen_t"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_xen_t_note, "crash_note_xen_t", "note"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_xen_t_desc, "crash_note_xen_t", "desc"); + XEN_HYPER_STRUCT_SIZE_INIT(crash_note_xen_core_t, "crash_note_xen_core_t"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_xen_core_t_note, "crash_note_xen_core_t", "note"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_xen_core_t_desc, "crash_note_xen_core_t", "desc"); + XEN_HYPER_STRUCT_SIZE_INIT(crash_note_xen_info_t, "crash_note_xen_info_t"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_xen_info_t_note, "crash_note_xen_info_t", "note"); + XEN_HYPER_MEMBER_OFFSET_INIT(crash_note_xen_info_t_desc, "crash_note_xen_info_t", "desc"); + XEN_HYPER_STRUCT_SIZE_INIT(crash_xen_core_t, "crash_xen_core_t"); + XEN_HYPER_STRUCT_SIZE_INIT(crash_xen_info_t, "crash_xen_info_t"); + XEN_HYPER_STRUCT_SIZE_INIT(xen_crash_xen_regs_t, "xen_crash_xen_regs_t"); + XEN_HYPER_STRUCT_SIZE_INIT(ELF_Prstatus,"ELF_Prstatus"); XEN_HYPER_MEMBER_OFFSET_INIT(ELF_Prstatus_pr_info, "ELF_Prstatus", "pr_info"); XEN_HYPER_MEMBER_OFFSET_INIT(ELF_Prstatus_pr_cursig, "ELF_Prstatus", "pr_cursig"); @@ -161,12 +183,12 @@ void x86_xen_hyper_pcpu_init(void) { - long cpu_info; - long init_tss; + ulong cpu_info; + ulong init_tss_base, init_tss; long sp; struct xen_hyper_pcpu_context *pcc; char *buf, *bp; - int i; + int i, cpuid; 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"); @@ -177,12 +199,12 @@ } /* get physical cpu context */ - xen_hyper_alloc_pcpu_context_space(XEN_HYPER_MAX_PCPUS()); - pcc = xhpct->context_array; - init_tss = symbol_value("init_tss"); + xen_hyper_alloc_pcpu_context_space(XEN_HYPER_MAX_CPUS()); + init_tss_base = symbol_value("init_tss"); buf = GETBUF(XEN_HYPER_SIZE(tss_struct)); - for (i = 0; i < xht->pcpus; - i++, pcc++, init_tss += XEN_HYPER_SIZE(tss_struct)) { + for_cpu_indexes(i, cpuid) + { + 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"); @@ -199,6 +221,7 @@ if(!(bp = xen_hyper_read_pcpu(cpu_info))) { error(FATAL, "cannot read cpu_info.\n"); } + pcc = &xhpct->context_array[cpuid]; xen_hyper_store_pcpu_context(pcc, cpu_info, bp); } FREEBUF(buf); @@ -213,7 +236,7 @@ /* set pcpu last */ if (!(xhpct->last = xen_hyper_id_to_pcpu_context(xht->crashing_cpu))) { - xhpct->last = xhpct->context_array; + xhpct->last = &xhpct->context_array[xht->cpu_idxs[0]]; } /* set vcpu last */ @@ -244,54 +267,152 @@ xen_hyper_dumpinfo_init(void) { Elf32_Nhdr *note; - char *bp, *np, *upp; + char *buf, *bp, *np, *upp; ulong addr; - int i, size; + long size; + int i, cpuid; + + /* + * kakuma NOTE: It is not clear that what ikind of + * a elf note format each one of the xen uses. + * So, we decide it confirming whether a symbol exists. + */ + if (STRUCT_EXISTS("note_buf_t")) + xhdit->note_ver = XEN_HYPER_ELF_NOTE_V1; + else if (STRUCT_EXISTS("crash_note_xen_t")) + xhdit->note_ver = XEN_HYPER_ELF_NOTE_V2; + else if (STRUCT_EXISTS("crash_note_xen_core_t")) + xhdit->note_ver = XEN_HYPER_ELF_NOTE_V3; + else { + error(WARNING, "unsupported elf note format.\n"); + return; + } + size = sizeof(struct xen_hyper_dumpinfo_context) * XEN_HYPER_MAX_CPUS(); + if((xhdit->context_array = malloc(size)) == NULL) { + error(FATAL, "cannot malloc dumpinfo table context space.\n"); + } + BZERO(xhdit->context_array, size); addr = symbol_value("per_cpu__crash_notes"); - for (i = 0; i < xht->pcpus; i++) { - xhdit->context[i].note = xen_hyper_per_cpu(addr, i); + for (i = 0; i < XEN_HYPER_MAX_CPUS(); i++) { + xhdit->context_array[i].note = xen_hyper_per_cpu(addr, i); } - if (XEN_HYPER_SIZE(note_buf_t) > - XEN_HYPER_SIZE(ELF_Prstatus) * xht->pcpus) { - size = XEN_HYPER_SIZE(note_buf_t); + if (xhdit->note_ver == XEN_HYPER_ELF_NOTE_V1) { + xhdit->note_size = XEN_HYPER_SIZE(note_buf_t); } else { - size = XEN_HYPER_SIZE(ELF_Prstatus) * xht->pcpus; + xhdit->note_size = XEN_HYPER_SIZE(crash_note_t); } - if(!(xhdit->ELF_Prstatus_array = malloc(size))) { - error(FATAL, "cannot malloc note_buf_t struct space.\n"); - } - bp = xhdit->ELF_Prstatus_array; - note = (Elf32_Nhdr *)bp; - if (!readmem(addr, KVADDR, bp, - XEN_HYPER_SIZE(note_buf_t), "per_cpu__crash_notes", RETURN_ON_ERROR)) { + + /* read a sample note */ + buf = GETBUF(xhdit->note_size); + if (!xen_hyper_fill_elf_notes(xhdit->context_array[xht->crashing_cpu].note, + buf, XEN_HYPER_ELF_NOTE_FILL_T_NOTE)) { error(FATAL, "cannot read per_cpu__crash_notes.\n"); } - /* cpu data */ - np = bp + sizeof(Elf32_Nhdr); - upp = np + note->n_namesz; - upp = (char *)roundup((ulong)upp, 4); - xhdit->offset = (Elf_Word)((ulong)upp - (ulong)note); - note = (Elf32_Nhdr *)(upp + note->n_descsz); - /* cr3 data */ - np = (char *)note + sizeof(Elf32_Nhdr); - upp = np + note->n_namesz; - upp = (char *)roundup((ulong)upp, 4); - upp = upp + note->n_descsz; - xhdit->size = upp - bp; + bp = buf; - bp = xhdit->ELF_Prstatus_array; + switch (xhdit->note_ver) { + case XEN_HYPER_ELF_NOTE_V1: + /* core data */ + note = (Elf32_Nhdr *)bp; + np = bp + sizeof(Elf32_Nhdr); + upp = np + note->n_namesz; + upp = (char *)roundup((ulong)upp, 4); + xhdit->core_offset = (Elf_Word)((ulong)upp - (ulong)note); + note = (Elf32_Nhdr *)(upp + note->n_descsz); + /* cr3 data */ + np = (char *)note + sizeof(Elf32_Nhdr); + upp = np + note->n_namesz; + upp = (char *)roundup((ulong)upp, 4); + upp = upp + note->n_descsz; + xhdit->core_size = upp - bp; + break; + case XEN_HYPER_ELF_NOTE_V2: + /* core data */ + xhdit->core_offset = XEN_HYPER_OFFSET(crash_note_core_t_desc); + xhdit->core_size = XEN_HYPER_SIZE(crash_note_core_t); + /* xen core */ + xhdit->xen_info_offset = XEN_HYPER_OFFSET(crash_note_xen_t_desc); + xhdit->xen_info_size = XEN_HYPER_SIZE(crash_note_xen_t); + if((xhdit->crash_note_xen_info_ptr = + malloc(xhdit->xen_info_size)) == NULL) { + error(FATAL, "cannot malloc dumpinfo table " + "crash_note_xen_info_ptr space.\n"); + } + memcpy(xhdit->crash_note_xen_info_ptr, + bp + xhdit->core_size, xhdit->xen_info_size); + xhdit->context_xen_info.note = + xhdit->context_array[xht->crashing_cpu].note + + xhdit->core_size; + xhdit->context_xen_info.pcpu_id = xht->crashing_cpu; + xhdit->context_xen_info.crash_xen_info_ptr = + xhdit->crash_note_xen_info_ptr + xhdit->xen_info_offset; + break; + case XEN_HYPER_ELF_NOTE_V3: + /* core data */ + xhdit->core_offset = XEN_HYPER_OFFSET(crash_note_core_t_desc); + xhdit->core_size = XEN_HYPER_SIZE(crash_note_core_t); + /* xen core */ + xhdit->xen_core_offset = XEN_HYPER_OFFSET(crash_note_xen_core_t_desc); + xhdit->xen_core_size = XEN_HYPER_SIZE(crash_note_xen_core_t); + if((xhdit->crash_note_xen_core_ptr = + malloc(xhdit->xen_core_size)) == NULL) { + error(FATAL, "cannot malloc dumpinfo table " + "crash_note_xen_core_ptr space.\n"); + } + memcpy(xhdit->crash_note_xen_core_ptr, + bp + xhdit->core_size, xhdit->xen_core_size); + xhdit->context_xen_core.note = + xhdit->context_array[xht->crashing_cpu].note + + xhdit->core_size; + xhdit->context_xen_core.pcpu_id = xht->crashing_cpu; + xhdit->context_xen_core.crash_xen_core_ptr = + xhdit->crash_note_xen_core_ptr + xhdit->xen_core_offset; + /* xen info */ + xhdit->xen_info_offset = XEN_HYPER_OFFSET(crash_note_xen_info_t_desc); + xhdit->xen_info_size = XEN_HYPER_SIZE(crash_note_xen_info_t); + if((xhdit->crash_note_xen_info_ptr = + malloc(xhdit->xen_info_size)) == NULL) { + error(FATAL, "cannot malloc dumpinfo table " + "crash_note_xen_info_ptr space.\n"); + } + memcpy(xhdit->crash_note_xen_info_ptr, + bp + xhdit->core_size + xhdit->xen_core_size, + xhdit->xen_info_size); + xhdit->context_xen_info.note = + xhdit->context_array[xht->crashing_cpu].note + + xhdit->core_size + xhdit->xen_core_size; + xhdit->context_xen_info.pcpu_id = xht->crashing_cpu; + xhdit->context_xen_info.crash_xen_info_ptr = + xhdit->crash_note_xen_info_ptr + xhdit->xen_info_offset; + break; + default: + error(FATAL, "logic error in cheking elf note format occurs.\n"); + } + + size = xhdit->core_size * XEN_HYPER_MAX_PCPUS(); + if(!(xhdit->crash_note_core_array = malloc(size))) { + error(FATAL, "cannot malloc note_buf_t struct space.\n"); + } + bp = xhdit->crash_note_core_array; BZERO(bp, size); - for (i = 0; i < xht->pcpus; i++, bp += XEN_HYPER_SIZE(ELF_Prstatus)) { - addr = xhdit->context[i].note + xhdit->offset; - if (!xen_hyper_fill_ELF_Prstatus(addr, bp)) { + for_cpu_indexes(i, cpuid) + { + addr = xhdit->context_array[cpuid].note; + if (!xen_hyper_fill_elf_notes(addr, bp, + XEN_HYPER_ELF_NOTE_FILL_T_CORE)) { error(FATAL, "cannot read ELF_Prstatus.\n"); } - xhdit->context[i].pcpu_id = i; - xhdit->context[i].ELF_Prstatus_ptr = bp; - xhdit->context[i].pr_reg_ptr = bp + XEN_HYPER_OFFSET(ELF_Prstatus_pr_reg); + xhdit->context_array[cpuid].pcpu_id = cpuid; + xhdit->context_array[cpuid].ELF_Prstatus_ptr = + bp + xhdit->core_offset; + xhdit->context_array[cpuid].pr_reg_ptr = + bp + xhdit->core_offset + + XEN_HYPER_OFFSET(ELF_Prstatus_pr_reg); + bp += xhdit->core_size; } + FREEBUF(buf); } /* @@ -300,7 +421,7 @@ struct xen_hyper_dumpinfo_context * xen_hyper_id_to_dumpinfo_context(uint id) { - return &xhdit->context[id]; + return &xhdit->context_array[id]; } /* @@ -311,9 +432,9 @@ { int i; - for (i = 0; i < xht->pcpus; i++) { - if (note == xhdit->context[i].note) { - return &xhdit->context[i]; + for (i = 0; i < XEN_HYPER_MAX_CPUS(); i++) { + if (note == xhdit->context_array[i].note) { + return &xhdit->context_array[i]; } } return NULL; @@ -323,25 +444,35 @@ * Fill ELF Notes header here. */ char * -xen_hyper_fill_elf_notes(ulong note, char *note_buf) +xen_hyper_fill_elf_notes(ulong note, char *note_buf, int type) { - if (!readmem(note, KVADDR, note_buf, XEN_HYPER_SIZE(note_buf_t), - "note_buf_t", RETURN_ON_ERROR)) { - error(WARNING, "cannot fill note_buf_t.\n"); - return NULL; - } - return note_buf; -} + long size; -/* - * Fill ELF_Prstatus in ELF Notes header here. - */ -char * -xen_hyper_fill_ELF_Prstatus(ulong prstatus, char *note_buf) -{ - if (!readmem(prstatus, KVADDR, note_buf, XEN_HYPER_SIZE(ELF_Prstatus), - "ELF_Prstatus", RETURN_ON_ERROR)) { - error(WARNING, "cannot fill ELF_Prstatus.\n"); + if (type == XEN_HYPER_ELF_NOTE_FILL_T_NOTE) + size = xhdit->note_size; + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_CORE) + size = xhdit->core_size; + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_XEN_CORE) + size = xhdit->xen_core_size; + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_PRS) + size = XEN_HYPER_SIZE(ELF_Prstatus); + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_XEN_REGS) + size = XEN_HYPER_SIZE(xen_crash_xen_regs_t); + else + return NULL; + + if (!readmem(note, KVADDR, note_buf, size, + "note_buf_t or crash_note_t", RETURN_ON_ERROR)) { + if (type == XEN_HYPER_ELF_NOTE_FILL_T_NOTE) + error(WARNING, "cannot fill note_buf_t or crash_note_t.\n"); + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_CORE) + error(WARNING, "cannot fill note core.\n"); + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_XEN_CORE) + error(WARNING, "cannot fill note xen core.\n"); + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_PRS) + error(WARNING, "cannot fill ELF_Prstatus.\n"); + else if (type == XEN_HYPER_ELF_NOTE_FILL_T_XEN_REGS) + error(WARNING, "cannot fill xen_crash_xen_regs_t.\n"); return NULL; } return note_buf; @@ -968,22 +1099,13 @@ struct xen_hyper_pcpu_context * xen_hyper_id_to_pcpu_context(uint id) { - struct xen_hyper_pcpu_context *pcc; - int i; - if (xhpct->context_array == NULL) { return NULL; } - if (id == XEN_HYPER_PCPU_ID_INVALID) { + if (!xen_hyper_test_pcpu_id(id)) { return NULL; } - for (i = 0, pcc = xhpct->context_array; i < XEN_HYPER_MAX_PCPUS(); - i++, pcc++) { - if (id == pcc->processor_id) { - return pcc; - } - } - return NULL; + return &xhpct->context_array[id]; } /* @@ -994,6 +1116,7 @@ { struct xen_hyper_pcpu_context *pcc; int i; + uint cpuid; if (xhpct->context_array == NULL) { return NULL; @@ -1001,8 +1124,9 @@ if (!pcpu) { return NULL; } - for (i = 0, pcc = xhpct->context_array; i < XEN_HYPER_MAX_PCPUS(); - i++, pcc++) { + for_cpu_indexes(i, cpuid) + { + pcc = &xhpct->context_array[cpuid]; if (pcpu == pcc->pcpu) { return pcc; } @@ -1099,6 +1223,29 @@ return FALSE; } +/* + * Test whether cpu for pcpu id exists. + */ +int +xen_hyper_test_pcpu_id(uint pcpu_id) +{ + ulong *cpumask = xht->cpumask; + uint i, j; + + if (pcpu_id > XEN_HYPER_MAX_CPUS()) { + return FALSE; + } + + i = pcpu_id / (sizeof(ulong) * 8); + j = pcpu_id % (sizeof(ulong) * 8); + cpumask += i; + if (*cpumask & (1UL << j)) { + return TRUE; + } else { + return FALSE; + } +} + /* @@ -1132,37 +1279,61 @@ } /* - * Calculate a number of physical cpu. + * Get cpu informatin around. + */ +void +xen_hyper_get_cpu_info(void) +{ + ulong addr; + ulong *cpumask; + uint *cpu_idx; + int i, j, cpus; + + get_symbol_data("max_cpus", sizeof(xht->max_cpus), &xht->max_cpus); + XEN_HYPER_STRUCT_SIZE_INIT(cpumask_t, "cpumask_t"); + if (XEN_HYPER_SIZE(cpumask_t) * 8 > xht->max_cpus) { + xht->max_cpus = XEN_HYPER_SIZE(cpumask_t) * 8; + } + if (xht->cpumask) { + free(xht->cpumask); + } + if((xht->cpumask = malloc(XEN_HYPER_SIZE(cpumask_t))) == NULL) { + error(FATAL, "cannot malloc cpumask space.\n"); + } + /* kakuma: It may be better to use cpu_present_map. */ + addr = symbol_value("cpu_online_map"); + if (!readmem(addr, KVADDR, xht->cpumask, + XEN_HYPER_SIZE(cpumask_t), "cpu_online_map", RETURN_ON_ERROR)) { + error(FATAL, "cannot read cpu_online_map.\n"); + } + if (xht->cpu_idxs) { + free(xht->cpu_idxs); + } + if((xht->cpu_idxs = malloc(sizeof(uint) * XEN_HYPER_MAX_PCPUS())) == NULL) { + error(FATAL, "cannot malloc cpu_idxs space.\n"); + } + for (i = cpus = 0, cpumask = xht->cpumask, cpu_idx = xht->cpu_idxs; + i < (XEN_HYPER_SIZE(cpumask_t)/sizeof(ulong)); i++, cpumask++) { + for (j = 0; j < sizeof(ulong) * 8; j++) { + if (*cpumask & (1UL << j)) { + *cpu_idx++ = i * sizeof(ulong) * 8 + j; + cpus++; + } + } + } + xht->pcpus = cpus; +} + +/* + * Calculate the number of physical cpu for x86. */ int x86_get_smp_cpus_hyper(void) { - ulong vaddr; - long cpuinfo_x86_x86_max_cores; - long cpuinfo_x86_booted_cores; - int total_x86_max_cores, total_booted_cores; - char *cpu_data; - int i; - if (xht->pcpus) { return xht->pcpus; } - vaddr = symbol_value("cpu_data"); - cpu_data = GETBUF(XEN_HYPER_SIZE(cpuinfo_x86)); - cpuinfo_x86_x86_max_cores = MEMBER_OFFSET("cpuinfo_x86", "x86_max_cores"); - cpuinfo_x86_booted_cores = MEMBER_OFFSET("cpuinfo_x86", "booted_cores"); - total_x86_max_cores = 0; - total_booted_cores = 0; - for (i = 0; i < xht->max_cpus; i++) { - xen_hyper_fill_cpu_data_x86(i, cpu_data); - total_x86_max_cores += - *(cpu_data + cpuinfo_x86_x86_max_cores); - total_booted_cores += - *(cpu_data + cpuinfo_x86_booted_cores); - } - xht->cores = total_x86_max_cores; - xht->pcpus = total_booted_cores; - FREEBUF(cpu_data); + xen_hyper_get_cpu_info(); return xht->pcpus; } @@ -1189,7 +1360,7 @@ /* - * Print with aligned string in specified length. + * Print an aligned string with specified length. */ void xen_hyper_fpr_indent(FILE *fp, int len, char *str1, char *str2, int flag) @@ -1207,7 +1378,7 @@ memset(buf, ' ', sizeof(buf)); buf[r] = '\0'; - if (flag == XEN_HYPER_PRI_L) { + if (flag & XEN_HYPER_PRI_L) { s1 = str1; s2 = buf; } else { @@ -1218,6 +1389,9 @@ fprintf(fp, "%s%s%s", s1, s2, str2); } else { fprintf(fp, "%s%s", s1, s2); + } + if (flag & XEN_HYPER_PRI_LF) { + fprintf(fp, "\n"); } } Index: xen_hyper_command.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper_command.c,v retrieving revision 1.1 retrieving revision 1.1.2.4 diff -u -r1.1 -r1.1.2.4 --- xen_hyper_command.c 5 Dec 2006 01:06:38 -0000 1.1 +++ xen_hyper_command.c 14 Dec 2006 04:49:42 -0000 1.1.2.4 @@ -35,8 +35,8 @@ #ifdef X86_64 char *xhregt[] = { - "r15", "r14", "r13", "r12", "rbp", "rbx", "r11", "r10", "r9", - "r8", "rax", "rcx", "rdx", "rsi", "rdi", "rip", "cs", "eflags", + "r15", "r14", "r13", "r12", "rbp", "rbx", "r11", "r10", "r9", "r8", + "rax", "rcx", "rdx", "rsi", "rdi", "orig_rax", "rip", "cs", "eflags", "rsp", "ss", "fs", "gs", "ds", "es", "fs", "gs", NULL }; @@ -229,6 +229,7 @@ { double mmem, tmem; char *act, *crash; + uint cpuid; int type, i, j; struct xen_hyper_pcpu_context *pcc; char buf1[XEN_HYPER_CMD_BUFSIZE]; @@ -239,7 +240,9 @@ } act = NULL; - for (i = 0, pcc = xhpct->context_array; i < xht->pcpus; i++, pcc++) { + for_cpu_indexes(i, cpuid) + { + pcc = xen_hyper_id_to_pcpu_context(cpuid); for (j = 0; j < dc->vcpu_cnt; j++) { if (pcc->current_vcpu == dc->vcpu[j]) { act = ">"; @@ -359,7 +362,7 @@ if (ena->cnt) { cnt = ena->cnt; } else { - cnt = xht->pcpus; + cnt = XEN_HYPER_MAX_PCPUS(); } for (i = 0; i < cnt; i++) { if (i == 0 || flag & XEN_HYPER_DUMPINFO_REGS || @@ -375,7 +378,7 @@ if (ena->cnt) { enc = ena->enc[i]; } else { - enc = &xhdit->context[i]; + enc = xen_hyper_id_to_dumpinfo_context(xht->cpu_idxs[i]); } show_xen_hyper_dumpinfo(flag, enc); } @@ -603,7 +606,8 @@ static void do_xen_hyper_pcpus(ulong flag, struct pcpu_args *pca) { - struct xen_hyper_pcpu_context *pcca; + struct xen_hyper_pcpu_context *pcc; + uint cpuid; int i; if (pca->cnt) { @@ -612,9 +616,10 @@ flag |= XEN_HYPER_PCPUS_1STCALL; } } else { - for (i = 0, pcca=xhpct->context_array; i < XEN_HYPER_MAX_PCPUS(); - i++, pcca++) { - show_xen_hyper_pcpus(flag, pcca); + for_cpu_indexes(i, cpuid) + { + pcc = xen_hyper_id_to_pcpu_context(cpuid); + show_xen_hyper_pcpus(flag, pcc); flag |= XEN_HYPER_PCPUS_1STCALL; } } @@ -634,6 +639,9 @@ } if ((flag & XEN_HYPER_PCPUS_REGS) || (!(flag & XEN_HYPER_PCPUS_REGS) && !(flag & XEN_HYPER_PCPUS_1STCALL))) { + if ((flag & XEN_HYPER_PCPUS_REGS) && (flag & XEN_HYPER_PCPUS_1STCALL)) { + fprintf(fp, "\n"); + } sprintf(buf, " PCID "); mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|RJUST, "PCPU"); strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); @@ -648,7 +656,7 @@ (char *)(pcc->current_vcpu)); fprintf(fp, "%s\n", buf); if (flag & XEN_HYPER_PCPUS_REGS) { - fprintf(fp, "\nRegister information:\n"); + fprintf(fp, "Register information:\n"); dump_struct("cpu_user_regs", pcc->guest_cpu_user_regs, 0); } } @@ -751,7 +759,7 @@ (buf1, "%s\n", pc->namelist_debug)); } - XEN_HYPER_PRI_CONS(fp, len, "DUMPFILE: ", flag); + XEN_HYPER_PRI_CONST(fp, len, "DUMPFILE: ", flag); if (ACTIVE()) { if (REMOTE_ACTIVE()) fprintf(fp, "%s@%s (remote live system)\n", @@ -769,7 +777,7 @@ } XEN_HYPER_PRI(fp, len, "CPUS: ", buf1, flag, - (buf1, "%d\n", xht->pcpus)); + (buf1, "%d\n", XEN_HYPER_MAX_PCPUS())); XEN_HYPER_PRI(fp, len, "DOMAINS: ", buf1, flag, (buf1, "%d\n", XEN_HYPER_MAX_DOMAINS())); /* !!!Display a date here if it can be found. */ @@ -780,7 +788,7 @@ XEN_HYPER_PRI(fp, len, "MACHINE: ", buf1, flag, (buf1, "%s ", uts->machine)); } else { - XEN_HYPER_PRI_CONS(fp, len, "MACHINE: unknown ", flag); + XEN_HYPER_PRI_CONST(fp, len, "MACHINE: unknown ", flag); } if ((mhz = machdep->processor_speed())) fprintf(fp, "(%ld Mhz)\n", mhz); @@ -1227,10 +1235,12 @@ flag = XEN_HYPER_PRI_R; if (!(pcc = xen_hyper_id_to_pcpu_context(vcc->processor))) { - error(FATAL, "cannot get pcpu context vcpu belongs.\n"); + error(WARNING, "cannot get pcpu context vcpu belongs.\n"); + return; } if (!(dc = xen_hyper_domain_to_domain_context(vcc->domain))) { - error(FATAL, "cannot get domain context vcpu belongs.\n"); + error(WARNING, "cannot get domain context vcpu belongs.\n"); + return; } XEN_HYPER_PRI(fp, len, "PCPU-ID: ", buf, flag, (buf, "%d\n", vcc->processor)); @@ -1246,7 +1256,7 @@ XEN_HYPER_PRI(fp, len, "DOMAIN: ", buf, flag, (buf, "%lx ", vcc->domain)); fprintf(fp, "(%s)\n", xen_hyper_domain_state_string(dc, buf, VERBOSE)); - XEN_HYPER_PRI_CONS(fp, len, "STATE: ", flag); + XEN_HYPER_PRI_CONST(fp, len, "STATE: ", flag); if (machdep->flags & HWRESET) { fprintf(fp, "HARDWARE RESET"); } else if (machdep->flags & INIT) { @@ -1295,7 +1305,7 @@ type = XEN_HYPER_STR_INVALID; if (dvalue != BADADDR) { - if (dvalue > xht->pcpus) { + if (dvalue > XEN_HYPER_MAX_CPUS()) { note_dad = xen_hyper_note_to_dumpinfo_context(dvalue); } else { note_did = xen_hyper_id_to_dumpinfo_context(dvalue); @@ -1303,7 +1313,7 @@ found++; } if ((hvalue != BADADDR)) { - if (hvalue > xht->pcpus) { + if (hvalue > XEN_HYPER_MAX_CPUS()) { note_had = xen_hyper_note_to_dumpinfo_context(hvalue); } else { note_hid = xen_hyper_id_to_dumpinfo_context(hvalue); Index: xen_hyper_defs.h =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper_defs.h,v retrieving revision 1.1 retrieving revision 1.1.2.4 diff -u -r1.1 -r1.1.2.4 --- xen_hyper_defs.h 5 Dec 2006 01:06:38 -0000 1.1 +++ xen_hyper_defs.h 14 Dec 2006 04:49:42 -0000 1.1.2.4 @@ -69,6 +69,14 @@ typedef uint16_t domid_t; typedef uint32_t Elf_Word; +/* NOTE kakuma: + * The following defines are temporary version for elf note format + * which is used only in crash. + */ +#define XEN_HYPER_ELF_NOTE_V1 1 +#define XEN_HYPER_ELF_NOTE_V2 2 +#define XEN_HYPER_ELF_NOTE_V3 3 + /* * Xen Hyper */ @@ -98,8 +106,8 @@ #if 0 #define XEN_HYPER_STACK_SIZE (machdep->pagesize << XEN_HYPER_STACK_ORDER) #endif -#define XEN_HYPER_GET_CPU_INFO(esp) \ - ((esp & ~(STACKSIZE()-1)) | \ +#define XEN_HYPER_GET_CPU_INFO(sp) \ + ((sp & ~(STACKSIZE()-1)) | \ (STACKSIZE() - XEN_HYPER_SIZE(cpu_info))) #define XEN_HYPER_CONRING_SIZE 16384 @@ -223,6 +231,12 @@ #define XEN_HYPER_DOMAIN_TYPE_GUEST (0x2) #define XEN_HYPER_DOMAIN_TYPE_INVALID (-1) +#define XEN_HYPER_ELF_NOTE_FILL_T_NOTE (0) +#define XEN_HYPER_ELF_NOTE_FILL_T_CORE (1) +#define XEN_HYPER_ELF_NOTE_FILL_T_XEN_CORE (2) +#define XEN_HYPER_ELF_NOTE_FILL_T_PRS (3) +#define XEN_HYPER_ELF_NOTE_FILL_T_XEN_REGS (4) + /* * command interface structs */ @@ -312,6 +326,8 @@ int crashing_cpu; struct xen_hyper_vcpu_context *crashing_vcc; ulong max_page; + ulong *cpumask; + uint *cpu_idxs; }; struct xen_hyper_dumpinfo_context { @@ -321,11 +337,33 @@ char *pr_reg_ptr; /* pointer to pr_reg buf */ }; +struct xen_hyper_dumpinfo_context_xen_core { + ulong note; /* per_cpu__crash_notes v3:xen_regs address */ + uint pcpu_id; + char *crash_xen_core_ptr; /* pointer to crash_xen_core_t buf */ +}; + +struct xen_hyper_dumpinfo_context_xen_info { + ulong note; /* per_cpu__crash_notes v2:xen, v3:xen_info address */ + uint pcpu_id; + char *crash_xen_info_ptr; /* pointer to v2:xen_crash_xen_regs_t, v3:crash_xen_info_t buf */ +}; + struct xen_hyper_dumpinfo_table { - char *ELF_Prstatus_array; - struct xen_hyper_dumpinfo_context context[NR_CPUS]; - Elf_Word offset; - Elf_Word size; + uint note_ver; + struct xen_hyper_dumpinfo_context *context_array; + struct xen_hyper_dumpinfo_context_xen_core context_xen_core; + struct xen_hyper_dumpinfo_context_xen_info context_xen_info; + char *crash_note_core_array; + char *crash_note_xen_core_ptr; + char *crash_note_xen_info_ptr; + Elf_Word note_size; + Elf_Word core_offset; + Elf_Word core_size; + Elf_Word xen_core_offset; + Elf_Word xen_core_size; + Elf_Word xen_info_offset; + Elf_Word xen_info_size; }; /* domain */ @@ -418,21 +456,30 @@ }; struct xen_hyper_size_table { - long ELF_Prstatus; + long ELF_Prstatus; /* elf note v1, v2, v3 */ long ELF_Signifo; long ELF_Gregset; long ELF_Timeval; long cpu_info; long cpu_time; long cpu_user_regs; + long cpumask_t; long cpuinfo_x86; + long crash_note_t; /* elf note v2, v3 */ + long crash_note_core_t; /* elf note v2, v3 */ + long crash_note_xen_t; /* elf note v2 */ + long crash_note_xen_core_t; /* elf note v3 */ + long crash_note_xen_info_t; /* elf note v3 */ + long crash_xen_core_t; /* elf note v3 */ + long crash_xen_info_t; /* elf note v3 */ long domain; - long note_buf_t; + long note_buf_t; /* elf note v1 */ long scheduler; long timer; long tss_struct; long vcpu; long vcpu_runstate_info; + long xen_crash_xen_regs_t; /* elf note v2 */ }; struct xen_hyper_offset_table { @@ -463,6 +510,23 @@ long cpu_time_stime_master_stamp; long cpu_time_tsc_scale; long cpu_time_calibration_timer; + /* crash_note_t */ + long crash_note_t_core; /* elf note v2, v3 */ + long crash_note_t_xen; /* elf note v2 */ + long crash_note_t_xen_regs; /* elf note v3 */ + long crash_note_t_xen_info; /* elf note v3 */ + /* crash_note_core_t elf note v2, v3 */ + long crash_note_core_t_note; + long crash_note_core_t_desc; + /* crash_note_xen_t elf note v2 */ + long crash_note_xen_t_note; + long crash_note_xen_t_desc; + /* crash_note_xen_core_t elf note v3 */ + long crash_note_xen_core_t_note; + long crash_note_xen_core_t_desc; + /* crash_note_xen_info_t elf note v3 */ + long crash_note_xen_info_t_note; + long crash_note_xen_info_t_desc; /* domain */ long domain_page_list; long domain_xenpage_list; @@ -516,6 +580,11 @@ */ #define XEN_HYPER_SIZE(X) (SIZE_verify(xen_hyper_size_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X)) #define XEN_HYPER_OFFSET(X) (OFFSET_verify(xen_hyper_offset_table.X, (char *)__FUNCTION__, __FILE__, __LINE__, #X)) +#define XEN_HYPER_INVALID_MEMBER(X) (xen_hyper_offset_table.X == INVALID_OFFSET) +#define XEN_HYPER_INVALID_SIZE(X) (xen_hyper_size_table.X == -1) +#define XEN_HYPER_VALID_SIZE(X) (xen_hyper_size_table.X >= 0) +#define XEN_HYPER_VALID_STRUCT(X) (xen_hyper_size_table.X >= 0) +#define XEN_HYPER_VALID_MEMBER(X) (xen_hyper_offset_table.X >= 0) #define XEN_HYPER_ASSIGN_SIZE(X) (xen_hyper_size_table.X) #define XEN_HYPER_ASSIGN_OFFSET(X) (xen_hyper_offset_table.X) @@ -525,12 +594,17 @@ #define XEN_HYPER_MEMBER_OFFSET_INIT(X, Y, Z) (XEN_HYPER_ASSIGN_OFFSET(X) = MEMBER_OFFSET(Y, Z)) /* + * System + */ +#define XEN_HYPER_MAX_CPUS() (xht->max_cpus) + +/* * Dump information */ -#define XEN_HYPER_X86_NOTE_ESP(regs) (regs[15]) #define XEN_HYPER_X86_NOTE_EIP(regs) (regs[12]) -#define XEN_HYPER_X86_64_NOTE_RSP(regs) (regs[18]) -#define XEN_HYPER_X86_64_NOTE_RIP(regs) (regs[15]) +#define XEN_HYPER_X86_NOTE_ESP(regs) (regs[15]) +#define XEN_HYPER_X86_64_NOTE_RIP(regs) (regs[16]) +#define XEN_HYPER_X86_64_NOTE_RSP(regs) (regs[19]) /* * Domain @@ -544,6 +618,10 @@ * Phisycal CPU */ #define XEN_HYPER_MAX_PCPUS() (xht->pcpus) +#define for_cpu_indexes(i, cpuid) \ + for (i = 0, cpuid = xht->cpu_idxs[i]; \ + i < XEN_HYPER_MAX_PCPUS(); \ + cpuid = xht->cpu_idxs[++i]) /* * VCPU @@ -559,11 +637,12 @@ #define XEN_HYPER_PRI(fp, len, str, buf, flag, args) \ sprintf args; \ xen_hyper_fpr_indent(fp, len, str, buf, flag); -#define XEN_HYPER_PRI_CONS(fp, len, str, flag) \ +#define XEN_HYPER_PRI_CONST(fp, len, str, flag) \ xen_hyper_fpr_indent(fp, len, str, NULL, flag); -#define XEN_HYPER_PRI_L 0 -#define XEN_HYPER_PRI_R 1 +#define XEN_HYPER_PRI_L (0x0) +#define XEN_HYPER_PRI_R (0x1) +#define XEN_HYPER_PRI_LF (0x2) /* * Global data @@ -616,8 +695,7 @@ void xen_hyper_post_init(void); struct xen_hyper_dumpinfo_context *xen_hyper_id_to_dumpinfo_context(uint id); struct xen_hyper_dumpinfo_context *xen_hyper_note_to_dumpinfo_context(ulong note); -char *xen_hyper_fill_elf_notes(ulong note, char *note_buf); -char *xen_hyper_fill_ELF_Prstatus(ulong prstatus, char *note_buf); +char *xen_hyper_fill_elf_notes(ulong note, char *note_buf, int type); /* domain */ void xen_hyper_refresh_domain_context_space(void); @@ -675,6 +753,8 @@ char *xen_hyper_fill_cpu_data_x86(int idx, char *cpuinfo_x86); int is_xen_hyper_vcpu_crash(struct xen_hyper_vcpu_context *vcc); void print_pcpu_header_hyper(FILE *out, int pcpu, int newline); +void xen_hyper_get_cpu_info(void); +int xen_hyper_test_pcpu_id(uint pcpu_id); /* * Xen Hyper command Index: xen_hyper_dump_tables.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper_dump_tables.c,v retrieving revision 1.1 retrieving revision 1.1.2.2 diff -u -r1.1 -r1.1.2.2 --- xen_hyper_dump_tables.c 5 Dec 2006 01:06:38 -0000 1.1 +++ xen_hyper_dump_tables.c 14 Dec 2006 00:03:41 -0000 1.1.2.2 @@ -26,6 +26,7 @@ #include "xen_hyper_defs.h" static void dump_xen_hyper_table(int verbose); +static void dump_xen_hyper_dumpinfo_table(int verbose); static void dump_xen_hyper_domain_table(int verbose); static void dump_xen_hyper_vcpu_table(int verbose); static void dump_xen_hyper_pcpu_table(int verbose); @@ -100,6 +101,10 @@ dump_xen_hyper_table(VERBOSE); else if (!strncmp("xen", optarg, strlen(optarg))) dump_xen_hyper_table(!VERBOSE); + else if (!strncmp("Dmp", optarg, strlen(optarg))) + dump_xen_hyper_dumpinfo_table(VERBOSE); + else if (!strncmp("dmp", optarg, strlen(optarg))) + dump_xen_hyper_dumpinfo_table(!VERBOSE); else if (!strncmp("Dom", optarg, strlen(optarg))) dump_xen_hyper_domain_table(VERBOSE); else if (!strncmp("dom", optarg, strlen(optarg))) @@ -132,6 +137,8 @@ fprintf(fp, " -H - hash_table data (verbose)\n"); fprintf(fp, " -X Xen - xen table data (verbose)\n"); fprintf(fp, " -X xen - xen table data\n"); + fprintf(fp, " -X Dmp - dumpinfo table data (verbose)\n"); + fprintf(fp, " -X dmp - dumpinfo table data\n"); fprintf(fp, " -X Dom - domain table data (verbose)\n"); fprintf(fp, " -X dom - domain table data\n"); fprintf(fp, " -X Vcp - vcpu table data (verbose)\n"); @@ -174,7 +181,8 @@ dump_xen_hyper_table(int verbose) { char buf[XEN_HYPER_CMD_BUFSIZE]; - int len, flag; + uint cpuid; + int len, flag, i; len = 14; flag = XEN_HYPER_PRI_R; @@ -197,6 +205,66 @@ (buf, "%p\n", xht->crashing_vcc)); XEN_HYPER_PRI(fp, len, "max_page: ", buf, flag, (buf, "%lu\n", xht->max_page)); + XEN_HYPER_PRI(fp, len, "cpumask: ", buf, flag, + (buf, "%p\n", xht->cpumask)); + XEN_HYPER_PRI(fp, len, "cpu_idxs: ", buf, flag, + (buf, "%p\n", xht->cpu_idxs)); + if (verbose) { + for_cpu_indexes(i, cpuid) + fprintf(fp, "%03d : %d\n", i, cpuid); + } +} + +/* + * "help -x dmp" output + */ +static void +dump_xen_hyper_dumpinfo_table(int verbose) +{ + char buf[XEN_HYPER_CMD_BUFSIZE]; + int len, flag; + + len = 24; + flag = XEN_HYPER_PRI_R; + + XEN_HYPER_PRI(fp, len, "note_ver: ", buf, flag, + (buf, "%u\n", xhdit->note_ver)); + XEN_HYPER_PRI(fp, len, "context_array: ", buf, flag, + (buf, "%p\n", xhdit->context_array)); + XEN_HYPER_PRI_CONST(fp, len, "context_xen_core: ", flag|XEN_HYPER_PRI_LF); + XEN_HYPER_PRI(fp, len, "note: ", buf, flag, + (buf, "%lx\n", xhdit->context_xen_core.note)); + XEN_HYPER_PRI(fp, len, "pcpu_id: ", buf, flag, + (buf, "%u\n", xhdit->context_xen_core.pcpu_id)); + XEN_HYPER_PRI(fp, len, "crash_xen_core_ptr: ", buf, flag, + (buf, "%p\n", xhdit->context_xen_core.crash_xen_core_ptr)); + XEN_HYPER_PRI_CONST(fp, len, "context_xen_info: ", flag|XEN_HYPER_PRI_LF); + XEN_HYPER_PRI(fp, len, "note: ", buf, flag, + (buf, "%lx\n", xhdit->context_xen_info.note)); + XEN_HYPER_PRI(fp, len, "pcpu_id: ", buf, flag, + (buf, "%u\n", xhdit->context_xen_info.pcpu_id)); + XEN_HYPER_PRI(fp, len, "crash_xen_info_ptr: ", buf, flag, + (buf, "%p\n", xhdit->context_xen_info.crash_xen_info_ptr)); + XEN_HYPER_PRI(fp, len, "crash_note_core_array: ", buf, flag, + (buf, "%p\n", xhdit->crash_note_core_array)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_core_ptr: ", buf, flag, + (buf, "%p\n", xhdit->crash_note_xen_core_ptr)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_info_ptr: ", buf, flag, + (buf, "%p\n", xhdit->crash_note_xen_info_ptr)); + XEN_HYPER_PRI(fp, len, "note_size: ", buf, flag, + (buf, "%u\n", xhdit->note_size)); + XEN_HYPER_PRI(fp, len, "core_offset: ", buf, flag, + (buf, "%u\n", xhdit->core_offset)); + XEN_HYPER_PRI(fp, len, "core_size: ", buf, flag, + (buf, "%u\n", xhdit->core_size)); + XEN_HYPER_PRI(fp, len, "xen_core_offset: ", buf, flag, + (buf, "%u\n", xhdit->xen_core_offset)); + XEN_HYPER_PRI(fp, len, "xen_core_size: ", buf, flag, + (buf, "%u\n", xhdit->xen_core_size)); + XEN_HYPER_PRI(fp, len, "xen_info_offset: ", buf, flag, + (buf, "%u\n", xhdit->xen_info_offset)); + XEN_HYPER_PRI(fp, len, "xen_info_size: ", buf, flag, + (buf, "%u\n", xhdit->xen_info_size)); } /* @@ -305,8 +373,24 @@ (buf, "%ld\n", xen_hyper_size_table.cpu_time)); XEN_HYPER_PRI(fp, len, "cpu_user_regs: ", buf, flag, (buf, "%ld\n", xen_hyper_size_table.cpu_user_regs)); + XEN_HYPER_PRI(fp, len, "cpumask_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.cpumask_t)); XEN_HYPER_PRI(fp, len, "cpuinfo_x86: ", buf, flag, (buf, "%ld\n", xen_hyper_size_table.cpuinfo_x86)); + XEN_HYPER_PRI(fp, len, "crash_note_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_note_t)); + XEN_HYPER_PRI(fp, len, "crash_note_core_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_note_core_t)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_note_xen_t)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_core_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_note_xen_core_t)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_info_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_note_xen_info_t)); + XEN_HYPER_PRI(fp, len, "crash_xen_core_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_xen_core_t)); + XEN_HYPER_PRI(fp, len, "crash_xen_info_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.crash_xen_info_t)); XEN_HYPER_PRI(fp, len, "domain: ", buf, flag, (buf, "%ld\n", xen_hyper_size_table.domain)); XEN_HYPER_PRI(fp, len, "note_buf_t: ", buf, flag, @@ -321,6 +405,8 @@ (buf, "%ld\n", xen_hyper_size_table.vcpu)); XEN_HYPER_PRI(fp, len, "vcpu_runstate_info: ", buf, flag, (buf, "%ld\n", xen_hyper_size_table.vcpu_runstate_info)); + XEN_HYPER_PRI(fp, len, "xen_crash_xen_regs_t: ", buf, flag, + (buf, "%ld\n", xen_hyper_size_table.xen_crash_xen_regs_t)); } /* @@ -381,6 +467,36 @@ (buf, "%ld\n", xen_hyper_offset_table.cpu_time_tsc_scale)); XEN_HYPER_PRI(fp, len, "cpu_time_calibration_timer: ", buf, flag, (buf, "%ld\n", xen_hyper_offset_table.cpu_time_calibration_timer)); + + XEN_HYPER_PRI(fp, len, "crash_note_t_core: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_t_core)); + XEN_HYPER_PRI(fp, len, "crash_note_t_xen: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_t_xen)); + XEN_HYPER_PRI(fp, len, "crash_note_t_xen_regs: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_t_xen_regs)); + XEN_HYPER_PRI(fp, len, "crash_note_t_xen_info: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_t_xen_info)); + + XEN_HYPER_PRI(fp, len, "crash_note_core_t_note: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_core_t_note)); + XEN_HYPER_PRI(fp, len, "crash_note_core_t_desc: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_core_t_desc)); + + XEN_HYPER_PRI(fp, len, "crash_note_xen_t_note: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_xen_t_note)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_t_desc: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_xen_t_desc)); + + XEN_HYPER_PRI(fp, len, "crash_note_xen_core_t_note: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_xen_core_t_note)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_core_t_desc: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_xen_core_t_desc)); + + XEN_HYPER_PRI(fp, len, "crash_note_xen_info_t_note: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_xen_info_t_note)); + XEN_HYPER_PRI(fp, len, "crash_note_xen_info_t_desc: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.crash_note_xen_info_t_desc)); + XEN_HYPER_PRI(fp, len, "domain_page_list: ", buf, flag, (buf, "%ld\n", xen_hyper_offset_table.domain_page_list)); XEN_HYPER_PRI(fp, len, "domain_xenpage_list: ", buf, flag,