# HG changeset patch # User Tristan Gingold # Date 1182654322 -7200 # Node ID b77b1936227c706a75f727304b641a1de14c6e3f # Parent a8389807379d38e936b8ced62ca3248bffe04a9a Remove IA64_GUEST_CONTEXT_RBS_OFFSET, pass the offset in the vcpu_reg struct. Fix displaying stack register in xenctx. Signed-off-by: Tristan Gingold diff -r a8389807379d -r b77b1936227c tools/xentrace/xenctx.c --- a/tools/xentrace/xenctx.c Sun Jun 24 04:59:54 2007 +0200 +++ b/tools/xentrace/xenctx.c Sun Jun 24 05:05:22 2007 +0200 @@ -335,7 +335,7 @@ void print_ctx(vcpu_guest_context_t *ctx struct vcpu_guest_context_regs *regs = &ctx->regs; struct vcpu_tr_regs *tr = &ctx->regs.tr; int i; - unsigned int rbs_size; + unsigned int rbs_size, cfm_sof; printf(" ip: %016lx ", regs->ip); print_symbol(regs->ip); @@ -485,15 +485,18 @@ void print_ctx(vcpu_guest_context_t *ctx printf("\n"); rbs_size = (regs->ar.bsp - regs->ar.bspstore) / 8; - for (i = 0; i < (regs->cfm & CFM_SOF_MASK); i++) { - unsigned int rbs_off = (((64 - (rbs_size % 64) - i)) / 64) + i; + cfm_sof = (regs->cfm & CFM_SOF_MASK); + for (i = 0; i < cfm_sof; i++) { + int off = cfm_sof - i; + unsigned int rbs_off = + (((62 - ((rbs_size + regs->rbs_voff) % 64) + off)) / 63) + off; if (rbs_off > rbs_size) break; printf(" r%02d: %016lx%s", 32 + i, regs->rbs[rbs_size - rbs_off], (i % 3) != 2 ? " " : "\n"); } - if (i && (i % 3) != 2) + if ((i % 3) != 0) printf ("\n"); if (disp_tlb) { diff -r a8389807379d -r b77b1936227c xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Sun Jun 24 04:59:54 2007 +0200 +++ b/xen/arch/ia64/xen/domain.c Sun Jun 24 05:05:22 2007 +0200 @@ -361,10 +361,6 @@ void startup_cpu_idle_loop(void) # error "XMAPPEDREGS_SHIFT doesn't match sizeof(mapped_regs_t)." #endif -#if (IA64_RBS_OFFSET % 512) != IA64_GUEST_CONTEXT_RBS_OFFSET -# error "arch-ia64.h: IA64_GUEST_CONTEXT_RBS_OFFSET must be adjusted." -#endif - void hlt_timer_fn(void *data) { struct vcpu *v = data; @@ -689,8 +685,10 @@ void arch_get_info_guest(struct vcpu *v, /* FIXME: to be reordered. */ c.nat->regs.nats = uregs->eml_unat; + c.nat->regs.rbs_voff = (IA64_RBS_OFFSET / 8) % 64; if (rbs_size < sizeof (c.nat->regs.rbs)) - memcpy (c.nat->regs.rbs, (char *)v + IA64_RBS_OFFSET, rbs_size); + memcpy (c.nat->regs.rbs, (char *)v + IA64_RBS_OFFSET, + rbs_size); c.nat->privregs_pfn = get_gpfn_from_mfn (virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT); @@ -777,7 +775,8 @@ int arch_set_info_guest(struct vcpu *v, if (!was_initialised) uregs->loadrs = (rbs_size) << 16; if (rbs_size == (uregs->loadrs >> 16)) - memcpy ((char *)v + IA64_RBS_OFFSET, c.nat->regs.rbs, rbs_size); + memcpy ((char *)v + IA64_RBS_OFFSET, + c.nat->regs.rbs, rbs_size); uregs->r1 = c.nat->regs.r[1]; uregs->r12 = c.nat->regs.r[12]; diff -r a8389807379d -r b77b1936227c xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.h Sun Jun 24 04:59:54 2007 +0200 +++ b/xen/include/public/arch-ia64.h Sun Jun 24 05:05:22 2007 +0200 @@ -470,17 +470,23 @@ struct vcpu_guest_context_regs { struct vcpu_tr_regs tr; - /* - * The rbs is intended to be the image of the stacked registers still - * in the cpu (not yet stored in memory). It is laid out as if it - * were written in memory at an 512 (64*8) * aligned address + offset. - * The offset is IA64_RBS_OFFSET % 512. - * rbs_nat contains NaT bits for the remaining rbs registers. - */ - /* Note: loadrs is 2**14 bytes == 2**11 slots. */ -#define IA64_GUEST_CONTEXT_RBS_OFFSET 448 + /* Physical registers in case of debug event. */ + unsigned long excp_iipa; + unsigned long excp_isr; + unsigned int excp_vector; + + /* The rbs is intended to be the image of the stacked + registers still in the cpu (not yet stored in memory). It + is laid out as if it were written in memory at an 512 (64*8) + aligned address + offset. + rbs_voff is (offset / 8). + rbs_nat contains NaT bits for the remaining rbs registers. + rbs_rnat contains NaT bits for in memory rbs registers. + Note: loadrs is 2**14 bytes == 2**11 slots. */ + unsigned int rbs_voff; unsigned long rbs[2048]; unsigned long rbs_nat; + unsigned long rbs_rnat; }; struct vcpu_guest_context { diff -r a8389807379d -r b77b1936227c xen/include/public/foreign/reference.size --- a/xen/include/public/foreign/reference.size Sun Jun 24 04:59:54 2007 +0200 +++ b/xen/include/public/foreign/reference.size Sun Jun 24 05:05:22 2007 +0200 @@ -8,8 +8,8 @@ xen_ia64_boot_param | - xen_ia64_boot_param | - - 96 ia64_tr_entry | - - 32 vcpu_tr_regs | - - 512 -vcpu_guest_context_regs | - - 21872 -vcpu_guest_context | 2800 5168 21904 +vcpu_guest_context_regs | - - 21904 +vcpu_guest_context | 2800 5168 21936 arch_vcpu_info | 24 16 0 vcpu_time_info | 32 32 32 vcpu_info | 64 64 48