From: Don Slutz Subject: [PATCH v8 19/20] xenctx: Fix print_ctx_32on64's print_special call. Date: Thu, 27 Mar 2014 15:05:46 -0400 Message-ID: <1395947147-5262-20-git-send-email-dslutz@verizon.com> References: <1395947147-5262-1-git-send-email-dslutz@verizon.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395947147-5262-1-git-send-email-dslutz@verizon.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Ian Campbell , Stefano Stabellini , George Dunlap , Ian Jackson , Don Slutz , Jan Beulich List-Id: xen-devel@lists.xenproject.org print_special() uses the width argument to both select output format and array size. So by passing 4 it expects an array of uint32_t. But an array of uint64_t is passed. So copy and mask the registers to 32 bits. Signed-off-by: Don Slutz --- tools/xentrace/xenctx.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c index b7f6e0f..6105ffb 100644 --- a/tools/xentrace/xenctx.c +++ b/tools/xentrace/xenctx.c @@ -444,8 +444,15 @@ static void print_ctx_32on64(vcpu_guest_context_x86_64_t *ctx) printf(" gs: %04x\n", regs->gs); if (xenctx.disp_all) { - print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 4); - print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 4); + uint32_t tmp_regs[8]; + int i; + + for (i = 0; i < 5; i++) + tmp_regs[i] = ctx->ctrlreg[i]; + print_special(tmp_regs, "cr", 0x1d, cr_reg_mask, 4); + for (i = 0; i < 8; i++) + tmp_regs[i] = ctx->debugreg[i]; + print_special(tmp_regs, "dr", 0xcf, dr_reg_mask, 4); } } -- 1.8.4