xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Don Slutz <dslutz@verizon.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Don Slutz <dslutz@verizon.com>,
	xen-devel@lists.xen.org
Subject: [PATCH v7 13/17] xenctx: Add convert of more registers to symbols
Date: Fri, 21 Mar 2014 13:43:46 -0400	[thread overview]
Message-ID: <532C7A52.5010507@terremark.com> (raw)
In-Reply-To: <532C5E7F0200007800126A41@nat28.tlf.novell.com>

[-- Attachment #1: Type: text/plain, Size: 4943 bytes --]


On 03/21/14 10:45, Jan Beulich wrote:
>>>> On 21.03.14 at 15:11, Don Slutz <dslutz@verizon.com> wrote:
>> --- a/tools/xentrace/xenctx.c
>> +++ b/tools/xentrace/xenctx.c
>> @@ -106,6 +106,9 @@ unsigned long long kernel_start = 0xffffffff80000000UL;
>>    unsigned long long kernel_start = 0xffffff8000000000UL;
>>    #endif
>>
>> +static const uint64_t cr_reg_mask[5] = { [2] = ~UINT64_C(0) };
>> +static const uint64_t dr_reg_mask[8] = { [0 ... 3] = ~UINT64_C(0) };
> This should be in an x86-specific section (preferably be added to
> an existing one rather than adding yet another).
>
> Also the patch came through line wrapped.
>
> Jan
>

Here is v7 with them moved (and hopefully not line wrapped):

 From bc8a441b718e302128f59a53908a1c05afca8680 Mon Sep 17 00:00:00 2001
From: Don Slutz <dslutz@verizon.com>
Date: Sat, 9 Nov 2013 20:32:40 -0500
Subject: [PATCH 13/17] xenctx: Add convert of more registers to symbols

For example can change:
  gs: 0000 @ ffffffff803ac000/0000000000000000
to
  gs: 0000 @ ffffffff803ac000/0000000000000000 boot_cpu_pda/

Signed-off-by: Don Slutz <dslutz@verizon.com>
---
  tools/xentrace/xenctx.c | 46 
++++++++++++++++++++++++++++++++++------------
  1 file changed, 34 insertions(+), 12 deletions(-)

diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index c574996..e6e41b6 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -43,6 +43,8 @@ typedef enum type_of_addr_ {
  } type_of_addr;

  #if defined (__i386__) || defined (__x86_64__)
+static const uint64_t cr_reg_mask[5] = { [2] = ~UINT64_C(0) };
+static const uint64_t dr_reg_mask[8] = { [0 ... 3] = ~UINT64_C(0) };
  typedef unsigned long long guest_word_t;
  #define FMT_32B_WORD "%08llx"
  #define FMT_64B_WORD "%016llx"
@@ -330,17 +332,29 @@ static void print_flags(uint64_t flags)
      printf("\n");
  }

-static void print_special(void *regs, const char *name, unsigned int 
mask, int width)
+static void print_special(void *regs, const char *name, unsigned int mask,
+                          const uint64_t reg_is_addr_mask[], int width)
  {
      unsigned int i;

      printf("\n");
      for (i = 0; mask; mask >>= 1, ++i)
          if (mask & 1) {
-            if (width == 4)
-                printf("%s%u: %08"PRIx32"\n", name, i, ((uint32_t *) 
regs)[i]);
+            if ( width == 4 )
+            {
+                printf("%s%u: %08"PRIx32, name, i, ((uint32_t *) regs)[i]);
+                if ( reg_is_addr_mask[i] )
+                    print_symbol(reg_is_addr_mask[i] & ((uint32_t *) 
regs)[i],
+                                 KERNEL_DATA_ADDR);
+            }
              else
-                printf("%s%u: %08"PRIx64"\n", name, i, ((uint64_t *) 
regs)[i]);
+            {
+                printf("%s%u: %016"PRIx64, name, i, ((uint64_t *) 
regs)[i]);
+                if ( reg_is_addr_mask[i] )
+                    print_symbol(reg_is_addr_mask[i] & ((uint64_t *) 
regs)[i],
+                                 KERNEL_DATA_ADDR);
+            }
+            printf("\n");
          }
  }

@@ -368,8 +382,8 @@ static void print_ctx_32(vcpu_guest_context_x86_32_t 
*ctx)
      printf(" gs:     %04x\n", regs->gs);

      if (xenctx.disp_all) {
-        print_special(ctx->ctrlreg, "cr", 0x1d, 4);
-        print_special(ctx->debugreg, "dr", 0xcf, 4);
+        print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 4);
+        print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 4);
      }
  }

@@ -397,8 +411,8 @@ 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, 4);
-        print_special(ctx->debugreg, "dr", 0xcf, 4);
+        print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 4);
+        print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 4);
      }
  }

@@ -436,13 +450,21 @@ static void 
print_ctx_64(vcpu_guest_context_x86_64_t *ctx)
      printf(" ds: %04x\t", regs->ds);
      printf(" es: %04x\n", regs->es);

-    printf(" fs: %04x @ %016"PRIx64"\n", regs->fs, ctx->fs_base);
-    printf(" gs: %04x @ %016"PRIx64"/%016"PRIx64"\n", regs->gs,
+    printf(" fs: %04x @ %016"PRIx64, regs->fs, ctx->fs_base);
+    print_symbol(ctx->fs_base, KERNEL_DATA_ADDR);
+    printf("\n");
+    printf(" gs: %04x @ %016"PRIx64"/%016"PRIx64, regs->gs,
             ctx->gs_base_kernel, ctx->gs_base_user);
+    if (symbol_table) {
+        print_symbol(ctx->gs_base_kernel, KERNEL_DATA_ADDR);
+        printf("/");
+        print_symbol(ctx->gs_base_user, KERNEL_DATA_ADDR);
+    }
+    printf("\n");

      if (xenctx.disp_all) {
-        print_special(ctx->ctrlreg, "cr", 0x1d, 8);
-        print_special(ctx->debugreg, "dr", 0xcf, 8);
+        print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 8);
+        print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 8);
      }
  }

-- 
1.7.11.7


Attached also just in case.
     -Don Slutz

[-- Attachment #2: 0013-xenctx-Add-convert-of-more-registers-to-symbols.patch --]
[-- Type: text/x-patch, Size: 4161 bytes --]

>From bc8a441b718e302128f59a53908a1c05afca8680 Mon Sep 17 00:00:00 2001
From: Don Slutz <dslutz@verizon.com>
Date: Sat, 9 Nov 2013 20:32:40 -0500
Subject: [PATCH 13/17] xenctx: Add convert of more registers to symbols

For example can change:
 gs: 0000 @ ffffffff803ac000/0000000000000000
to
 gs: 0000 @ ffffffff803ac000/0000000000000000 boot_cpu_pda/

Signed-off-by: Don Slutz <dslutz@verizon.com>
---
 tools/xentrace/xenctx.c | 46 ++++++++++++++++++++++++++++++++++------------
 1 file changed, 34 insertions(+), 12 deletions(-)

diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index c574996..e6e41b6 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -43,6 +43,8 @@ typedef enum type_of_addr_ {
 } type_of_addr;
 
 #if defined (__i386__) || defined (__x86_64__)
+static const uint64_t cr_reg_mask[5] = { [2] = ~UINT64_C(0) };
+static const uint64_t dr_reg_mask[8] = { [0 ... 3] = ~UINT64_C(0) };
 typedef unsigned long long guest_word_t;
 #define FMT_32B_WORD "%08llx"
 #define FMT_64B_WORD "%016llx"
@@ -330,17 +332,29 @@ static void print_flags(uint64_t flags)
     printf("\n");
 }
 
-static void print_special(void *regs, const char *name, unsigned int mask, int width)
+static void print_special(void *regs, const char *name, unsigned int mask,
+                          const uint64_t reg_is_addr_mask[], int width)
 {
     unsigned int i;
 
     printf("\n");
     for (i = 0; mask; mask >>= 1, ++i)
         if (mask & 1) {
-            if (width == 4)
-                printf("%s%u: %08"PRIx32"\n", name, i, ((uint32_t *) regs)[i]);
+            if ( width == 4 )
+            {
+                printf("%s%u: %08"PRIx32, name, i, ((uint32_t *) regs)[i]);
+                if ( reg_is_addr_mask[i] )
+                    print_symbol(reg_is_addr_mask[i] & ((uint32_t *) regs)[i],
+                                 KERNEL_DATA_ADDR);
+            }
             else
-                printf("%s%u: %08"PRIx64"\n", name, i, ((uint64_t *) regs)[i]);
+            {
+                printf("%s%u: %016"PRIx64, name, i, ((uint64_t *) regs)[i]);
+                if ( reg_is_addr_mask[i] )
+                    print_symbol(reg_is_addr_mask[i] & ((uint64_t *) regs)[i],
+                                 KERNEL_DATA_ADDR);
+            }
+            printf("\n");
         }
 }
 
@@ -368,8 +382,8 @@ static void print_ctx_32(vcpu_guest_context_x86_32_t *ctx)
     printf(" gs:     %04x\n", regs->gs);
 
     if (xenctx.disp_all) {
-        print_special(ctx->ctrlreg, "cr", 0x1d, 4);
-        print_special(ctx->debugreg, "dr", 0xcf, 4);
+        print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 4);
+        print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 4);
     }
 }
 
@@ -397,8 +411,8 @@ 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, 4);
-        print_special(ctx->debugreg, "dr", 0xcf, 4);
+        print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 4);
+        print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 4);
     }
 }
 
@@ -436,13 +450,21 @@ static void print_ctx_64(vcpu_guest_context_x86_64_t *ctx)
     printf(" ds: %04x\t", regs->ds);
     printf(" es: %04x\n", regs->es);
 
-    printf(" fs: %04x @ %016"PRIx64"\n", regs->fs, ctx->fs_base);
-    printf(" gs: %04x @ %016"PRIx64"/%016"PRIx64"\n", regs->gs,
+    printf(" fs: %04x @ %016"PRIx64, regs->fs, ctx->fs_base);
+    print_symbol(ctx->fs_base, KERNEL_DATA_ADDR);
+    printf("\n");
+    printf(" gs: %04x @ %016"PRIx64"/%016"PRIx64, regs->gs,
            ctx->gs_base_kernel, ctx->gs_base_user);
+    if (symbol_table) {
+        print_symbol(ctx->gs_base_kernel, KERNEL_DATA_ADDR);
+        printf("/");
+        print_symbol(ctx->gs_base_user, KERNEL_DATA_ADDR);
+    }
+    printf("\n");
 
     if (xenctx.disp_all) {
-        print_special(ctx->ctrlreg, "cr", 0x1d, 8);
-        print_special(ctx->debugreg, "dr", 0xcf, 8);
+        print_special(ctx->ctrlreg, "cr", 0x1d, cr_reg_mask, 8);
+        print_special(ctx->debugreg, "dr", 0xcf, dr_reg_mask, 8);
     }
 }
 
-- 
1.7.11.7


[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2014-03-21 17:43 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 19:06 [PATCH v5 00/17] xenctx: Many changes Don Slutz
2014-03-20 19:06 ` [PATCH v5 01/17] xenctx: clean up usage output Don Slutz
2014-03-21 14:21   ` Ian Campbell
2014-03-20 19:06 ` [PATCH v5 02/17] xenctx: Clean up stack trace when hypercall_page not in symbol table Don Slutz
2014-03-20 19:06 ` [PATCH v5 03/17] xenctx: Add -n (--display-stack-pages) option to output larger stack Don Slutz
2014-03-21 14:29   ` Ian Campbell
2014-03-22 20:49     ` Don Slutz
2014-03-24 10:39       ` Ian Campbell
2014-03-24 13:26         ` Don Slutz
2014-03-20 19:06 ` [PATCH v5 04/17] xenctx: Add command line options -b (--bytes-per-line) and -l (--lines) Don Slutz
2014-03-21 14:32   ` Ian Campbell
2014-03-22 20:08     ` Don Slutz
2014-03-22 20:10       ` Don Slutz
2014-03-24 10:44       ` Ian Campbell
2014-03-24 16:58         ` Don Slutz
2014-03-27 15:55           ` Ian Campbell
2014-03-27 19:36             ` Don Slutz
2014-03-20 19:06 ` [PATCH v5 05/17] xenctx: Add command line option -D (--decode-as-ascii) Don Slutz
2014-03-21 14:38   ` Ian Campbell
2014-03-21 18:42     ` Don Slutz
2014-03-24 10:46       ` Ian Campbell
2014-03-24 17:00         ` Don Slutz
2014-03-20 19:06 ` [PATCH v5 06/17] xenctx: Add command line option -t (--tag-stack-dump) Don Slutz
2014-03-21 14:40   ` Ian Campbell
2014-03-20 19:06 ` [PATCH v5 07/17] xenctx: Change print_symbol to do the space before Don Slutz
2014-03-20 19:06 ` [PATCH v5 08/17] xenctx: More info on failed to map page Don Slutz
2014-03-20 19:06 ` [PATCH v5 09/17] xenctx: Add command line option -T (--tag-trace) Don Slutz
2014-03-21 14:44   ` Ian Campbell
2014-03-24 19:54     ` Don Slutz
2014-03-27 15:56       ` Ian Campbell
2014-03-20 19:06 ` [PATCH v5 10/17] xenctx: Add -m (--memory) <maddr> option to dump memory at maddr Don Slutz
2014-03-21 14:53   ` Ian Campbell
2014-03-25 19:16     ` Don Slutz
2014-03-20 19:06 ` [PATCH v5 11/17] xenctx: Add -d (--dump-as-stack) <daddr> option to dump memory at daddr as a stack Don Slutz
2014-03-21 14:57   ` Ian Campbell
2014-03-24 15:22     ` Don Slutz
2014-03-27 15:58       ` Ian Campbell
2014-03-27 17:05         ` Don Slutz
2014-03-27 17:20           ` Ian Campbell
2014-03-27 17:49             ` Don Slutz
2014-03-20 19:07 ` [PATCH v5 12/17] xenctx: change is_kernel_text() into kernel_addr() Don Slutz
2014-03-21 15:02   ` Ian Campbell
2014-03-21 17:45     ` Don Slutz
2014-03-24 22:23       ` Don Slutz
2014-03-25  9:13         ` Jan Beulich
2014-03-27 15:59         ` Ian Campbell
2014-03-20 19:07 ` [PATCH v5 13/17] xenctx: Add convert of more registers to symbols Don Slutz
2014-03-21 10:24   ` Jan Beulich
2014-03-21 12:34     ` Don Slutz
2014-03-21 14:11       ` [PATCH v6 " Don Slutz
2014-03-21 14:45         ` Jan Beulich
2014-03-21 17:43           ` Don Slutz [this message]
2014-03-24 10:51             ` [PATCH v7 " Ian Campbell
2014-03-21 15:03         ` [PATCH v6 " Ian Campbell
2014-03-21 17:38           ` Don Slutz
2014-03-21 15:07   ` [PATCH v5 " Ian Campbell
2014-03-21 15:11     ` Jan Beulich
2014-03-21 16:06       ` Ian Campbell
2014-03-21 18:16         ` Don Slutz
2014-03-24 10:49           ` Ian Campbell
2014-03-24 14:09             ` Don Slutz
2014-03-27 16:06               ` Ian Campbell
2014-03-27 16:52                 ` Don Slutz
2014-03-20 19:07 ` [PATCH v5 14/17] xenctx: Add output of vcpu value and state for --all-vcpus Don Slutz
2014-03-27 16:07   ` Ian Campbell
2014-03-20 19:07 ` [PATCH v5 15/17] xenctx: Fix handling of !guest_protected_mode Don Slutz
2014-03-21 15:09   ` Ian Campbell
2014-03-24 22:35     ` Don Slutz
2014-03-20 19:07 ` [PATCH v5 16/17] xenctx: Allow output for offline vcpu when specified Don Slutz
2014-03-21 15:11   ` Ian Campbell
2014-03-24 13:20     ` Don Slutz
2014-03-20 19:07 ` [PATCH v5 17/17] xenctx: Fixup options checking Don Slutz
2014-03-21 15:13   ` Ian Campbell
2014-03-24 14:26     ` Don Slutz
2014-03-27 16:10       ` Ian Campbell
2014-03-21 15:14 ` [PATCH v5 00/17] xenctx: Many changes Ian Campbell
2014-03-21 17:37   ` Don Slutz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532C7A52.5010507@terremark.com \
    --to=dslutz@verizon.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).