Index: ia64.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/ia64.c,v retrieving revision 1.6 retrieving revision 1.6.2.2 diff -u -r1.6 -r1.6.2.2 --- ia64.c 7 Aug 2007 01:56:19 -0000 1.6 +++ ia64.c 22 Aug 2007 23:54:45 -0000 1.6.2.2 @@ -4063,7 +4063,7 @@ } /* frametable virtual address */ - addr = kvaddr - VIRT_FRAME_TABLE_ADDR; + addr = kvaddr - xhmachdep->frame_table; dirp = symbol_value("frametable_pg_dir"); dirp += ((addr >> PGDIR_SHIFT_3L) & (PTRS_PER_PGD - 1)) * sizeof(ulong); @@ -4095,6 +4095,7 @@ ia64_post_init_hyper(void) { struct machine_specific *ms; + ulong frame_table; ms = &ia64_machine_specific; @@ -4127,6 +4128,14 @@ ms->unwind = ia64_old_unwind; } ms->unwind_init(); + + if (symbol_exists("frame_table")) { + frame_table = symbol_value("frame_table"); + readmem(frame_table, KVADDR, &xhmachdep->frame_table, sizeof(ulong), + "frame_table virtual address", FAULT_ON_ERROR); + } else { + error(FATAL, "cannot find frame_table virtual address."); + } } int Index: lkcd_x86_trace.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/lkcd_x86_trace.c,v retrieving revision 1.4 retrieving revision 1.4.8.2 diff -u -r1.4 -r1.4.8.2 --- lkcd_x86_trace.c 20 Apr 2007 04:40:21 -0000 1.4 +++ lkcd_x86_trace.c 14 Aug 2007 23:58:02 -0000 1.4.8.2 @@ -1424,7 +1424,8 @@ #ifdef REDHAT if (XEN_HYPER_MODE()) { func_name = kl_funcname(pc); - if (STREQ(func_name, "idle_loop") || STREQ(func_name, "hypercall")) { + if (STREQ(func_name, "idle_loop") || STREQ(func_name, "hypercall") + || STREQ(func_name, "handle_exception")) { UPDATE_FRAME(func_name, pc, 0, sp, bp, asp, 0, 0, bp - sp, 0); return(trace->nframes); } @@ -1681,7 +1682,9 @@ } } if (func_name && XEN_HYPER_MODE()) { - if (STREQ(func_name, "continue_nmi")) { + if (STREQ(func_name, "continue_nmi") || + STREQ(func_name, "vmx_asm_vmexit_handler") || + STREQ(func_name, "deferred_nmi")) { /* Interrupt frame */ sp = curframe->fp + 4; asp = (uaddr_t*)((uaddr_t)sbp + (STACK_SIZE - @@ -1697,6 +1700,8 @@ sp = curframe->fp + 4; bp = sp + get_framesize(pc, bt); func_name = kl_funcname(pc); + if (!func_name) + return trace->nframes; continue; } } Index: x86_64.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/x86_64.c,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -r1.10 -r1.10.2.1 --- x86_64.c 7 Aug 2007 01:56:19 -0000 1.10 +++ x86_64.c 14 Aug 2007 05:49:52 -0000 1.10.2.1 @@ -5417,7 +5417,7 @@ case POST_GDB: XEN_HYPER_STRUCT_SIZE_INIT(cpuinfo_x86, "cpuinfo_x86"); XEN_HYPER_STRUCT_SIZE_INIT(tss_struct, "tss_struct"); - XEN_HYPER_MEMBER_OFFSET_INIT(tss_struct_rsp0, "tss_struct", "rsp0"); + XEN_HYPER_ASSIGN_OFFSET(tss_struct_rsp0) = MEMBER_OFFSET("tss_struct", "__blh") + sizeof(short unsigned int); XEN_HYPER_MEMBER_OFFSET_INIT(tss_struct_ist, "tss_struct", "ist"); if (symbol_exists("cpu_data")) { xht->cpu_data_address = symbol_value("cpu_data"); Index: xen_hyper.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper.c,v retrieving revision 1.4 retrieving revision 1.4.6.5 diff -u -r1.4 -r1.4.6.5 --- xen_hyper.c 28 Apr 2007 02:19:07 -0000 1.4 +++ xen_hyper.c 22 Aug 2007 06:05:14 -0000 1.4.6.5 @@ -51,13 +51,16 @@ machdep->memory_size(); #ifdef IA64 - if((xht->__per_cpu_offset = malloc(sizeof(ulong) * XEN_HYPER_MAX_CPUS())) == NULL) { - error(FATAL, "cannot malloc __per_cpu_offset space.\n"); - } - if (!readmem(symbol_value("__per_cpu_offset"), KVADDR, - xht->__per_cpu_offset, sizeof(ulong) * XEN_HYPER_MAX_CPUS(), - "__per_cpu_offset", RETURN_ON_ERROR)) { - error(FATAL, "cannot read __per_cpu_offset.\n"); + if (symbol_exists("__per_cpu_offset")) { + xht->flags |= XEN_HYPER_SMP; + if((xht->__per_cpu_offset = malloc(sizeof(ulong) * XEN_HYPER_MAX_CPUS())) == NULL) { + error(FATAL, "cannot malloc __per_cpu_offset space.\n"); + } + if (!readmem(symbol_value("__per_cpu_offset"), KVADDR, + xht->__per_cpu_offset, sizeof(ulong) * XEN_HYPER_MAX_CPUS(), + "__per_cpu_offset", RETURN_ON_ERROR)) { + error(FATAL, "cannot read __per_cpu_offset.\n"); + } } #endif @@ -169,6 +172,14 @@ XEN_HYPER_MEMBER_OFFSET_INIT(domain_next_in_list, "domain", "next_in_list"); XEN_HYPER_MEMBER_OFFSET_INIT(domain_domain_flags, "domain", "domain_flags"); XEN_HYPER_MEMBER_OFFSET_INIT(domain_evtchn, "domain", "evtchn"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_hvm, "domain", "is_hvm"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_privileged, "domain", "is_privileged"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_debugger_attached, "domain", "debugger_attached"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_polling, "domain", "is_polling"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_dying, "domain", "is_dying"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_paused_by_controller, "domain", "is_paused_by_controller"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shutting_down, "domain", "is_shutting_down"); + XEN_HYPER_MEMBER_OFFSET_INIT(domain_is_shut_down, "domain", "is_shut_down"); XEN_HYPER_MEMBER_OFFSET_INIT(domain_vcpu, "domain", "vcpu"); XEN_HYPER_MEMBER_OFFSET_INIT(domain_arch, "domain", "arch"); @@ -533,9 +544,10 @@ { Elf32_Nhdr *note; char *buf, *bp, *np, *upp; + char *nccp, *xccp; ulong addr; long size; - int i, cpuid; + int i, cpuid, samp_cpuid; /* * NOTE kakuma: It is not clear that what kind of @@ -546,10 +558,13 @@ 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"); + else if (STRUCT_EXISTS("crash_xen_core_t")) { + if (STRUCT_EXISTS("crash_note_xen_core_t")) + xhdit->note_ver = XEN_HYPER_ELF_NOTE_V3; + else + xhdit->note_ver = XEN_HYPER_ELF_NOTE_V4; + } else { + error(WARNING, "found unsupported elf note format while checking of xen dumpinfo.\n"); return; } if (!xen_hyper_test_pcpu_id(XEN_HYPER_CRASHING_CPU())) { @@ -557,30 +572,55 @@ return; } + /* allocate a context area */ 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); + size = sizeof(struct xen_hyper_dumpinfo_context_xen_core) * XEN_HYPER_MAX_CPUS(); + if((xhdit->context_xen_core_array = malloc(size)) == NULL) { + error(FATAL, "cannot malloc dumpinfo table context_xen_core_array space.\n"); + } + BZERO(xhdit->context_xen_core_array, size); addr = symbol_value("per_cpu__crash_notes"); for (i = 0; i < XEN_HYPER_MAX_CPUS(); i++) { - xhdit->context_array[i].note = xen_hyper_per_cpu(addr, i); + ulong addr_notes; + + addr_notes = xen_hyper_per_cpu(addr, i); + if (xhdit->note_ver == XEN_HYPER_ELF_NOTE_V4) { + if (!readmem(addr_notes, KVADDR, &(xhdit->context_array[i].note), + sizeof(ulong), "per_cpu__crash_notes", RETURN_ON_ERROR)) { + error(WARNING, "cannot read per_cpu__crash_notes.\n"); + return; + } + } else { + xhdit->context_array[i].note = addr_notes; + } } if (xhdit->note_ver == XEN_HYPER_ELF_NOTE_V1) { xhdit->note_size = XEN_HYPER_SIZE(note_buf_t); + } else if (xhdit->note_ver == XEN_HYPER_ELF_NOTE_V4) { + xhdit->note_size = XEN_HYPER_ELF_NOTE_V4_NOTE_SIZE; } else { xhdit->note_size = XEN_HYPER_SIZE(crash_note_t); } - + /* read a sample note */ buf = GETBUF(xhdit->note_size); - if (!xen_hyper_fill_elf_notes(xhdit->context_array[XEN_HYPER_CRASHING_CPU()].note, + if (xhdit->note_ver == XEN_HYPER_ELF_NOTE_V4) + samp_cpuid = xht->cpu_idxs[0]; + else + samp_cpuid = XEN_HYPER_CRASHING_CPU(); + xhdit->xen_info_cpu = samp_cpuid; + if (!xen_hyper_fill_elf_notes(xhdit->context_array[samp_cpuid].note, buf, XEN_HYPER_ELF_NOTE_FILL_T_NOTE)) { error(FATAL, "cannot read per_cpu__crash_notes.\n"); } bp = buf; + /* Get elf format information for each version. */ switch (xhdit->note_ver) { case XEN_HYPER_ELF_NOTE_V1: /* core data */ @@ -604,19 +644,6 @@ /* 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[XEN_HYPER_CRASHING_CPU()].note + - xhdit->core_size; - xhdit->context_xen_info.pcpu_id = XEN_HYPER_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 */ @@ -625,22 +652,57 @@ /* 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[XEN_HYPER_CRASHING_CPU()].note + - xhdit->core_size; - xhdit->context_xen_core.pcpu_id = XEN_HYPER_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); + break; + case XEN_HYPER_ELF_NOTE_V4: + /* 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); + upp = upp + note->n_descsz; + xhdit->core_size = (Elf_Word)((ulong)upp - (ulong)note); + if (XEN_HYPER_ELF_NOTE_V4_NOTE_SIZE < xhdit->core_size + 32) { + error(WARNING, "note size is assumed on crash is incorrect.(core data)\n"); + return; + } + /* xen core */ + note = (Elf32_Nhdr *)upp; + np = (char *)note + sizeof(Elf32_Nhdr); + upp = np + note->n_namesz; + upp = (char *)roundup((ulong)upp, 4); + xhdit->xen_core_offset = (Elf_Word)((ulong)upp - (ulong)note); + upp = upp + note->n_descsz; + xhdit->xen_core_size = (Elf_Word)((ulong)upp - (ulong)note); + if (XEN_HYPER_ELF_NOTE_V4_NOTE_SIZE < + xhdit->core_size + xhdit->xen_core_size + 32) { + error(WARNING, "note size is assumed on crash is incorrect.(xen core)\n"); + return; + } + /* xen info */ + note = (Elf32_Nhdr *)upp; + np = (char *)note + sizeof(Elf32_Nhdr); + upp = np + note->n_namesz; + upp = (char *)roundup((ulong)upp, 4); + xhdit->xen_info_offset = (Elf_Word)((ulong)upp - (ulong)note); + upp = upp + note->n_descsz; + xhdit->xen_info_size = (Elf_Word)((ulong)upp - (ulong)note); + if (XEN_HYPER_ELF_NOTE_V4_NOTE_SIZE < + xhdit->core_size + xhdit->xen_core_size + xhdit->xen_info_size) { + error(WARNING, "note size is assumed on crash is incorrect.(xen info)\n"); + return; + } + xhdit->note_size = xhdit->core_size + xhdit->xen_core_size + xhdit->xen_info_size; + break; + default: + error(FATAL, "logic error in cheking elf note format occurs.\n"); + } + + /* fill xen info context. */ + if (xhdit->note_ver >= XEN_HYPER_ELF_NOTE_V3) { if((xhdit->crash_note_xen_info_ptr = malloc(xhdit->xen_info_size)) == NULL) { error(FATAL, "cannot malloc dumpinfo table " @@ -650,37 +712,75 @@ bp + xhdit->core_size + xhdit->xen_core_size, xhdit->xen_info_size); xhdit->context_xen_info.note = - xhdit->context_array[XEN_HYPER_CRASHING_CPU()].note + + xhdit->context_array[samp_cpuid].note + xhdit->core_size + xhdit->xen_core_size; - xhdit->context_xen_info.pcpu_id = XEN_HYPER_CRASHING_CPU(); + xhdit->context_xen_info.pcpu_id = samp_cpuid; 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"); } - + + /* allocate note core */ size = xhdit->core_size * XEN_HYPER_NR_PCPUS(); if(!(xhdit->crash_note_core_array = malloc(size))) { - error(FATAL, "cannot malloc note_buf_t struct space.\n"); + error(FATAL, "cannot malloc crash_note_core_array space.\n"); } - bp = xhdit->crash_note_core_array; - BZERO(bp, size); + nccp = xhdit->crash_note_core_array; + BZERO(nccp, size); + + /* allocate xen core */ + if (xhdit->note_ver >= XEN_HYPER_ELF_NOTE_V2) { + size = xhdit->xen_core_size * XEN_HYPER_NR_PCPUS(); + if(!(xhdit->crash_note_xen_core_array = malloc(size))) { + error(FATAL, "cannot malloc dumpinfo table " + "crash_note_xen_core_array space.\n"); + } + xccp = xhdit->crash_note_xen_core_array; + BZERO(xccp, size); + } + + /* fill a context. */ for_cpu_indexes(i, cpuid) { + /* fill core context. */ addr = xhdit->context_array[cpuid].note; - if (!xen_hyper_fill_elf_notes(addr, bp, + if (!xen_hyper_fill_elf_notes(addr, nccp, XEN_HYPER_ELF_NOTE_FILL_T_CORE)) { - error(FATAL, "cannot read ELF_Prstatus.\n"); + error(FATAL, "cannot read elf note core.\n"); } xhdit->context_array[cpuid].pcpu_id = cpuid; xhdit->context_array[cpuid].ELF_Prstatus_ptr = - bp + xhdit->core_offset; + nccp + xhdit->core_offset; xhdit->context_array[cpuid].pr_reg_ptr = - bp + xhdit->core_offset + + nccp + xhdit->core_offset + XEN_HYPER_OFFSET(ELF_Prstatus_pr_reg); - bp += xhdit->core_size; + + /* Is there xen core data? */ + if (xhdit->note_ver < XEN_HYPER_ELF_NOTE_V2) { + nccp += xhdit->core_size; + continue; + } + if (xhdit->note_ver == XEN_HYPER_ELF_NOTE_V2 && + cpuid != samp_cpuid) { + xccp += xhdit->xen_core_size; + nccp += xhdit->core_size; + continue; + } + + /* fill xen core context, in case of more elf note V2. */ + xhdit->context_xen_core_array[cpuid].note = + xhdit->context_array[cpuid].note + + xhdit->core_size; + xhdit->context_xen_core_array[cpuid].pcpu_id = cpuid; + xhdit->context_xen_core_array[cpuid].crash_xen_core_ptr = + xccp + xhdit->xen_core_offset; + if (!xen_hyper_fill_elf_notes(xhdit->context_xen_core_array[cpuid].note, + xccp, XEN_HYPER_ELF_NOTE_FILL_T_XEN_CORE)) { + error(FATAL, "cannot read elf note xen core.\n"); + } + xccp += xhdit->xen_core_size; + nccp += xhdit->core_size; } + FREEBUF(buf); } @@ -713,11 +813,14 @@ /* * Fill ELF Notes header here. + * This assume that variable note has a top address of an area for + * specified type. */ char * xen_hyper_fill_elf_notes(ulong note, char *note_buf, int type) { long size; + ulong rp = note; if (type == XEN_HYPER_ELF_NOTE_FILL_T_NOTE) size = xhdit->note_size; @@ -725,6 +828,8 @@ 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_XEN_CORE_M) + size = xhdit->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) @@ -732,7 +837,7 @@ else return NULL; - if (!readmem(note, KVADDR, note_buf, size, + if (!readmem(rp, 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"); @@ -740,6 +845,8 @@ 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_XEN_CORE_M) + error(WARNING, "cannot fill note core & 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) @@ -1051,8 +1158,28 @@ dc->next_in_list = ULONG(dp + XEN_HYPER_OFFSET(domain_next_in_list)); if (XEN_HYPER_VALID_MEMBER(domain_domain_flags)) dc->domain_flags = ULONG(dp + XEN_HYPER_OFFSET(domain_domain_flags)); - else + else if (XEN_HYPER_VALID_MEMBER(domain_is_shut_down)) { + dc->domain_flags = 0; + if (*(dp + XEN_HYPER_OFFSET(domain_is_hvm))) { + dc->domain_flags |= XEN_HYPER_DOMS_HVM; + } else if (*(dp + XEN_HYPER_OFFSET(domain_is_privileged))) { + dc->domain_flags |= XEN_HYPER_DOMS_privileged; + } else if (*(dp + XEN_HYPER_OFFSET(domain_debugger_attached))) { + dc->domain_flags |= XEN_HYPER_DOMS_debugging; + } else if (*(dp + XEN_HYPER_OFFSET(domain_is_polling))) { + dc->domain_flags |= XEN_HYPER_DOMS_polling; + } else if (*(dp + XEN_HYPER_OFFSET(domain_is_paused_by_controller))) { + dc->domain_flags |= XEN_HYPER_DOMS_ctrl_pause; + } else if (*(dp + XEN_HYPER_OFFSET(domain_is_dying))) { + dc->domain_flags |= XEN_HYPER_DOMS_dying; + } else if (*(dp + XEN_HYPER_OFFSET(domain_is_shutting_down))) { + dc->domain_flags |= XEN_HYPER_DOMS_shuttingdown; + } else if (*(dp + XEN_HYPER_OFFSET(domain_is_shut_down))) { + dc->domain_flags |= XEN_HYPER_DOMS_shutdown; + } + } else { dc->domain_flags = XEN_HYPER_DOMF_ERROR; + } dc->evtchn = ULONG(dp + XEN_HYPER_OFFSET(domain_evtchn)); for (i = 0; i < XEN_HYPER_MAX_VIRT_CPUS; i++) { dc->vcpu[i] = ULONG(dp + XEN_HYPER_OFFSET(domain_vcpu) + i*sizeof(void *)); Index: xen_hyper_command.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper_command.c,v retrieving revision 1.5 retrieving revision 1.5.6.5 diff -u -r1.5 -r1.5.6.5 --- xen_hyper_command.c 28 Apr 2007 02:19:07 -0000 1.5 +++ xen_hyper_command.c 23 Aug 2007 01:13:23 -0000 1.5.6.5 @@ -429,7 +429,17 @@ } sprintf(buf, " PCID "); mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|RJUST, "ENOTE"); - sprintf(&buf[strlen(buf)], " PID PPID PGRP SID"); +// sprintf(&buf[strlen(buf)], " PID PPID PGRP SID"); + strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|RJUST, "CORE"); + if (xhdit->note_ver >= XEN_HYPER_ELF_NOTE_V2) { + strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|RJUST, "XEN_CORE"); + } + if (xhdit->note_ver >= XEN_HYPER_ELF_NOTE_V3) { + strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|RJUST, "XEN_INFO"); + } fprintf(fp, "%s\n", buf); } if (dia->cnt) { @@ -449,7 +459,7 @@ ulong addr; ulong *regs; long tv_sec, tv_usec; - int pid, i, regcnt; + int i, regcnt; if (!dic || !dic->note) { return; @@ -460,6 +470,7 @@ mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|LONG_HEX|RJUST, MKSTR(dic->note)); +#if 0 pid = INT(note_buf + XEN_HYPER_OFFSET(ELF_Prstatus_pr_pid)); sprintf(&buf[strlen(buf)], " %5d ", pid); pid = INT(note_buf + XEN_HYPER_OFFSET(ELF_Prstatus_pr_ppid)); @@ -468,6 +479,24 @@ sprintf(&buf[strlen(buf)], "%5d ", pid); pid = INT(note_buf + XEN_HYPER_OFFSET(ELF_Prstatus_pr_sid)); sprintf(&buf[strlen(buf)], "%5d", pid); +#endif + strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|LONG_HEX|RJUST, + MKSTR(dic->note)); + if (xhdit->note_ver >= XEN_HYPER_ELF_NOTE_V2) { + strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|LONG_HEX|RJUST, + MKSTR(dic->note + xhdit->core_size)); + } + if (xhdit->note_ver >= XEN_HYPER_ELF_NOTE_V3) { + strncat(buf, " ", XEN_HYPER_CMD_BUFSIZE-strlen(buf)-1); + if (xhdit->xen_info_cpu == dic->pcpu_id) + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|LONG_HEX|RJUST, + MKSTR(dic->note + xhdit->core_size + xhdit->xen_core_size)); + else + mkstring(&buf[strlen(buf)], VADDR_PRLEN, CENTER|RJUST, "--"); + + } fprintf(fp, "%s\n", buf); @@ -515,7 +544,8 @@ addr = (ulong)note_buf + XEN_HYPER_OFFSET(ELF_Prstatus_pr_reg); regs = (ulong *)addr; - fprintf(fp, "Register information:\n"); + fprintf(fp, "Register information(%lx):\n", + dic->note + xhdit->core_offset + XEN_HYPER_OFFSET(ELF_Prstatus_pr_reg)); for (i = 0; i < regcnt; i++, regs++) { if (xhregt[i] == NULL) { break; @@ -1256,18 +1286,34 @@ if (stat == XEN_HYPER_DOMF_ERROR) { sprintf(buf, verbose ? "(unknown)" : "??"); - } else if (stat & XEN_HYPER_DOMF_shutdown) { - sprintf(buf, verbose ? "DOMAIN_SHUTDOWN" : "SH"); - } else if (stat & XEN_HYPER_DOMF_dying) { - sprintf(buf, verbose ? "DOMAIN_DYING" : "DY"); - } else if (stat & XEN_HYPER_DOMF_ctrl_pause) { - sprintf(buf, verbose ? "DOMAIN_CTRL_PAUSE" : "CP"); - } else if (stat & XEN_HYPER_DOMF_polling) { - sprintf(buf, verbose ? "DOMAIN_POLLING" : "PO"); - } else if (stat & XEN_HYPER_DOMF_paused) { - sprintf(buf, verbose ? "DOMAIN_PAUSED" : "PA"); + } else if (XEN_HYPER_VALID_MEMBER(domain_domain_flags)) { + if (stat & XEN_HYPER_DOMF_shutdown) { + sprintf(buf, verbose ? "DOMAIN_SHUTDOWN" : "SF"); + } else if (stat & XEN_HYPER_DOMF_dying) { + sprintf(buf, verbose ? "DOMAIN_DYING" : "DY"); + } else if (stat & XEN_HYPER_DOMF_ctrl_pause) { + sprintf(buf, verbose ? "DOMAIN_CTRL_PAUSE" : "CP"); + } else if (stat & XEN_HYPER_DOMF_polling) { + sprintf(buf, verbose ? "DOMAIN_POLLING" : "PO"); + } else if (stat & XEN_HYPER_DOMF_paused) { + sprintf(buf, verbose ? "DOMAIN_PAUSED" : "PA"); + } else { + sprintf(buf, verbose ? "DOMAIN_RUNNING" : "RU"); + } } else { - sprintf(buf, verbose ? "DOMAIN_RUNNING" : "RU"); + if (stat & XEN_HYPER_DOMS_shutdown) { + sprintf(buf, verbose ? "DOMAIN_SHUTDOWN" : "SF"); + } else if (stat & XEN_HYPER_DOMS_shuttingdown) { + sprintf(buf, verbose ? "DOMAIN_SHUTTINGDOWN" : "SH"); + } else if (stat & XEN_HYPER_DOMS_dying) { + sprintf(buf, verbose ? "DOMAIN_DYING" : "DY"); + } else if (stat & XEN_HYPER_DOMS_ctrl_pause) { + sprintf(buf, verbose ? "DOMAIN_CTRL_PAUSE" : "CP"); + } else if (stat & XEN_HYPER_DOMS_polling) { + sprintf(buf, verbose ? "DOMAIN_POLLING" : "PO"); + } else { + sprintf(buf, verbose ? "DOMAIN_RUNNING" : "RU"); + } } return buf; Index: xen_hyper_defs.h =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper_defs.h,v retrieving revision 1.4 retrieving revision 1.4.6.7 diff -u -r1.4 -r1.4.6.7 --- xen_hyper_defs.h 28 Apr 2007 02:19:07 -0000 1.4 +++ xen_hyper_defs.h 22 Aug 2007 06:05:14 -0000 1.4.6.7 @@ -74,14 +74,13 @@ #define PERCPU_ADDR (DEFAULT_SHAREDINFO_ADDR - PERCPU_PAGE_SIZE) #define DIRECTMAP_VIRT_START (0xf000000000000000) #define DIRECTMAP_VIRT_END PERCPU_ADDR -#define VIRT_FRAME_TABLE_ADDR (0xf300000000000000) -#define VIRT_FRAME_TABLE_END (0xf400000000000000) +#define VIRT_FRAME_TABLE_SIZE (0x0100000000000000) #define PERCPU_VIRT_ADDR(vaddr) \ (((vaddr) >= PERCPU_ADDR) && ((vaddr) < PERCPU_ADDR + PERCPU_PAGE_SIZE)) #define FRAME_TABLE_VIRT_ADDR(vaddr) \ - ((vaddr) >= VIRT_FRAME_TABLE_ADDR && (vaddr) < VIRT_FRAME_TABLE_END) + ((vaddr) >= xhmachdep->frame_table && (vaddr) < xhmachdep->frame_table + VIRT_FRAME_TABLE_SIZE) #undef IA64_RBS_OFFSET #define IA64_RBS_OFFSET ((XEN_HYPER_SIZE(vcpu) + 15) & ~15) @@ -101,6 +100,14 @@ #define XEN_HYPER_ELF_NOTE_V1 1 #define XEN_HYPER_ELF_NOTE_V2 2 #define XEN_HYPER_ELF_NOTE_V3 3 +#define XEN_HYPER_ELF_NOTE_V4 4 + +#ifdef X86 +#define XEN_HYPER_ELF_NOTE_V4_NOTE_SIZE 0x100 +#endif +#if defined(X86_64) || defined(IA64) +#define XEN_HYPER_ELF_NOTE_V4_NOTE_SIZE 0x200 +#endif /* * Xen Hyper @@ -129,7 +136,9 @@ ((ulong)(var) + (((ulong)(cpu))<__per_cpu_offset[cpu])) + ((xht->flags & XEN_HYPER_SMP) ? \ + (ulong)(var) + (xht->__per_cpu_offset[cpu]) : \ + (ulong)(var)) #endif #if defined(X86) || defined(X86_64) @@ -155,6 +164,7 @@ /* Prepared domain ID. */ #define XEN_HYPER_DOMID_IO (0x7FF1U) #define XEN_HYPER_DOMID_XEN (0x7FF2U) + /* Domain flags (domain_flags). */ /* Is this domain privileged? */ #define XEN_HYPER__DOMF_privileged 0 @@ -180,6 +190,32 @@ /* Domain flag error */ #define XEN_HYPER_DOMF_ERROR ((ulong)(-1)) +/* Domain status. */ + /* Is this an HVM guest? */ +#define XEN_HYPER__DOMS_HVM 0 +#define XEN_HYPER_DOMS_HVM (1UL<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(fp, len, "context_xen_core_array: ", buf, flag, + (buf, "%p\n", xhdit->context_xen_core_array)); + if (verbose && xhdit->context_xen_core_array) { + xen_hyper_dump_mem((long *)xhdit->context_xen_core_array, + sizeof(struct xen_hyper_dumpinfo_context_xen_core) * + XEN_HYPER_MAX_CPUS(), sizeof(long)); + } 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)); @@ -283,12 +283,13 @@ xhdit->core_size * XEN_HYPER_NR_PCPUS(), sizeof(long)); } - XEN_HYPER_PRI(fp, len, "crash_note_xen_core_ptr: ", buf, flag, - (buf, "%p\n", xhdit->crash_note_xen_core_ptr)); - if (verbose && xhdit->crash_note_xen_core_ptr) { + XEN_HYPER_PRI(fp, len, "crash_note_xen_core_array: ", buf, flag, + (buf, "%p\n", xhdit->crash_note_xen_core_array)); + if (verbose && xhdit->crash_note_xen_core_array) { xen_hyper_dump_mem( - xhdit->crash_note_xen_core_ptr, - xhdit->xen_core_size, sizeof(long)); + xhdit->crash_note_xen_core_array, + xhdit->xen_core_size * XEN_HYPER_NR_PCPUS(), + sizeof(long)); } XEN_HYPER_PRI(fp, len, "crash_note_xen_info_ptr: ", buf, flag, (buf, "%p\n", xhdit->crash_note_xen_info_ptr)); @@ -297,6 +298,8 @@ xhdit->crash_note_xen_info_ptr, xhdit->xen_info_size, sizeof(long)); } + XEN_HYPER_PRI(fp, len, "xen_info_cpu: ", buf, flag, + (buf, "%u\n", xhdit->xen_info_cpu)); XEN_HYPER_PRI(fp, len, "note_size: ", buf, flag, (buf, "%u\n", xhdit->note_size)); XEN_HYPER_PRI(fp, len, "core_offset: ", buf, flag, @@ -320,13 +323,52 @@ xen_hyper_dump_xen_hyper_domain_table(int verbose) { char buf[XEN_HYPER_CMD_BUFSIZE]; - int len, flag; + struct xen_hyper_domain_context *dcca; + int len, flag, i; len = 22; flag = XEN_HYPER_PRI_R; XEN_HYPER_PRI(fp, len, "context_array: ", buf, flag, (buf, "%p\n", xhdt->context_array)); + if (verbose) { + char buf1[XEN_HYPER_CMD_BUFSIZE]; + int j; + for (i = 0, dcca = xhdt->context_array; + i < xhdt->context_array_cnt; i++, dcca++) { + snprintf(buf, XEN_HYPER_CMD_BUFSIZE, "context_array[%d]: ", i); + XEN_HYPER_PRI_CONST(fp, len, buf, flag|XEN_HYPER_PRI_LF); + XEN_HYPER_PRI(fp, len, "domain: ", buf, flag, + (buf, "%lx\n", dcca->domain)); + XEN_HYPER_PRI(fp, len, "domain_id: ", buf, flag, + (buf, "%d\n", dcca->domain_id)); + XEN_HYPER_PRI(fp, len, "tot_pages: ", buf, flag, + (buf, "%x\n", dcca->tot_pages)); + XEN_HYPER_PRI(fp, len, "max_pages: ", buf, flag, + (buf, "%x\n", dcca->max_pages)); + XEN_HYPER_PRI(fp, len, "xenheap_pages: ", buf, flag, + (buf, "%x\n", dcca->xenheap_pages)); + XEN_HYPER_PRI(fp, len, "shared_info: ", buf, flag, + (buf, "%lx\n", dcca->shared_info)); + XEN_HYPER_PRI(fp, len, "sched_priv: ", buf, flag, + (buf, "%lx\n", dcca->sched_priv)); + XEN_HYPER_PRI(fp, len, "next_in_list: ", buf, flag, + (buf, "%lx\n", dcca->next_in_list)); + XEN_HYPER_PRI(fp, len, "domain_flags: ", buf, flag, + (buf, "%lx\n", dcca->domain_flags)); + XEN_HYPER_PRI(fp, len, "evtchn: ", buf, flag, + (buf, "%lx\n", dcca->evtchn)); + XEN_HYPER_PRI(fp, len, "vcpu_cnt: ", buf, flag, + (buf, "%d\n", dcca->vcpu_cnt)); + for (j = 0; j < XEN_HYPER_MAX_VIRT_CPUS; j++) { + snprintf(buf1, XEN_HYPER_CMD_BUFSIZE, "vcpu[%d]: ", j); + XEN_HYPER_PRI(fp, len, buf1, buf, flag, + (buf, "%lx\n", dcca->vcpu[j])); + } + XEN_HYPER_PRI(fp, len, "vcpu_context_array: ", buf, flag, + (buf, "%p\n", dcca->vcpu_context_array)); + } + } XEN_HYPER_PRI(fp, len, "context_array_cnt: ", buf, flag, (buf, "%d\n", xhdt->context_array_cnt)); XEN_HYPER_PRI(fp, len, "running_domains: ", buf, flag, @@ -365,6 +407,57 @@ (buf, "%p\n", xhvct->vcpu_context_arrays)); XEN_HYPER_PRI(fp, len, "vcpu_context_arrays_cnt: ", buf, flag, (buf, "%d\n", xhvct->vcpu_context_arrays_cnt)); + if (verbose) { + struct xen_hyper_vcpu_context_array *vcca; + struct xen_hyper_vcpu_context *vca; + int i, j; + + for (i = 0, vcca = xhvct->vcpu_context_arrays; + i < xhvct->vcpu_context_arrays_cnt; i++, vcca++) { + snprintf(buf, XEN_HYPER_CMD_BUFSIZE, "vcpu_context_arrays[%d]: ", i); + XEN_HYPER_PRI_CONST(fp, len, buf, flag|XEN_HYPER_PRI_LF); + if (vcca->context_array) { + XEN_HYPER_PRI(fp, len, "context_array: ", buf, flag, + (buf, "%p\n", vcca->context_array)); + } else { + XEN_HYPER_PRI(fp, len, "context_array: ", buf, flag, + (buf, "NULL\n")); + } + XEN_HYPER_PRI(fp, len, "context_array_cnt: ", buf, flag, + (buf, "%d\n", vcca->context_array_cnt)); + XEN_HYPER_PRI(fp, len, "context_array_valid: ", buf, flag, + (buf, "%d\n", vcca->context_array_valid)); + for (j = 0, vca = vcca->context_array; + j < vcca->context_array_cnt; j++, vca++) { + snprintf(buf, XEN_HYPER_CMD_BUFSIZE, "context_array[%d]: ", j); + XEN_HYPER_PRI_CONST(fp, len, buf, flag|XEN_HYPER_PRI_LF); + XEN_HYPER_PRI(fp, len, "vcpu: ", buf, flag, + (buf, "%lx\n", vca->vcpu)); + XEN_HYPER_PRI(fp, len, "vcpu_id: ", buf, flag, + (buf, "%d\n", vca->vcpu_id)); + XEN_HYPER_PRI(fp, len, "processor: ", buf, flag, + (buf, "%d\n", vca->processor)); + XEN_HYPER_PRI(fp, len, "vcpu_info: ", buf, flag, + (buf, "%lx\n", vca->vcpu_info)); + XEN_HYPER_PRI(fp, len, "domain: ", buf, flag, + (buf, "%lx\n", vca->domain)); + XEN_HYPER_PRI(fp, len, "next_in_list: ", buf, flag, + (buf, "%lx\n", vca->next_in_list)); + XEN_HYPER_PRI(fp, len, "sleep_tick: ", buf, flag, + (buf, "%lx\n", vca->sleep_tick)); + XEN_HYPER_PRI(fp, len, "sched_priv: ", buf, flag, + (buf, "%lx\n", vca->sched_priv)); + XEN_HYPER_PRI(fp, len, "state: ", buf, flag, + (buf, "%d\n", vca->state)); + XEN_HYPER_PRI(fp, len, "state_entry_time: ", buf, flag, + (buf, "%llux\n", (unsigned long long)(vca->state_entry_time))); + XEN_HYPER_PRI(fp, len, "runstate_guest: ", buf, flag, + (buf, "%lx\n", vca->runstate_guest)); + XEN_HYPER_PRI(fp, len, "vcpu_flags: ", buf, flag, + (buf, "%lx\n", vca->vcpu_flags)); + } + } + } XEN_HYPER_PRI(fp, len, "idle_vcpu: ", buf, flag, (buf, "%lx\n", xhvct->idle_vcpu)); XEN_HYPER_PRI(fp, len, "idle_vcpu_context_array: ", buf, flag, @@ -673,11 +766,29 @@ XEN_HYPER_PRI(fp, len, "domain_next_in_list: ", buf, flag, (buf, "%ld\n", xen_hyper_offset_table.domain_next_in_list)); XEN_HYPER_PRI(fp, len, "domain_domain_flags: ", buf, flag, - (buf, "%ld\n", xen_hyper_offset_table.domain_domain_flags)); + (buf, "%lx\n", xen_hyper_offset_table.domain_domain_flags)); XEN_HYPER_PRI(fp, len, "domain_evtchn: ", buf, flag, (buf, "%ld\n", xen_hyper_offset_table.domain_evtchn)); + XEN_HYPER_PRI(fp, len, "domain_is_hvm: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_hvm)); + XEN_HYPER_PRI(fp, len, "domain_is_privileged: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_privileged)); + XEN_HYPER_PRI(fp, len, "domain_debugger_attached: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_debugger_attached)); + XEN_HYPER_PRI(fp, len, "domain_is_polling: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_polling)); + XEN_HYPER_PRI(fp, len, "domain_is_dying: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_dying)); + XEN_HYPER_PRI(fp, len, "domain_is_paused_by_controller: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_paused_by_controller)); + XEN_HYPER_PRI(fp, len, "domain_is_shutting_down: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_shutting_down)); + XEN_HYPER_PRI(fp, len, "domain_is_shut_down: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_is_shut_down)); XEN_HYPER_PRI(fp, len, "domain_vcpu: ", buf, flag, (buf, "%ld\n", xen_hyper_offset_table.domain_vcpu)); + XEN_HYPER_PRI(fp, len, "domain_arch: ", buf, flag, + (buf, "%ld\n", xen_hyper_offset_table.domain_arch)); #ifdef IA64 XEN_HYPER_PRI(fp, len, "mm_struct_pgd: ", buf, flag, Index: xen_hyper_global_data.c =================================================================== RCS file: /cvsroot/xen_ia64/people/xencrash/src/crash/xen_hyper_global_data.c,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -u -r1.4 -r1.4.6.1 --- xen_hyper_global_data.c 28 Apr 2007 02:19:07 -0000 1.4 +++ xen_hyper_global_data.c 22 Aug 2007 02:06:55 -0000 1.4.6.1 @@ -130,8 +130,11 @@ " ", " 1. the DOMAIN-ID.", " 2. the struct domain pointer.", -" 3. the domain state (SH, DY, CP, PO, PA, RU).", -" 4. the TYPE of domain.", +" 3. the domain state", +" (SF:fully shut down, SH:shutting down, DY:dying,", +" CP:pause by controller software, PO:polling event channels,", +" PA:pause by the hypervisor, RU:running).", +" 4. the TYPE of domain", " (O:dom_io, X:dom_xen, I:idle domain, 0:domain 0, U:domain U).", " 5. displays max_pages member of domain.", " 6. displays tot_pages member of domain.",