[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xenctx: Add 16 bit output



commit 701ce4a698dbabb9599e66e50ae19768a8e882d3
Author:     Don Slutz <dslutz@xxxxxxxxxxx>
AuthorDate: Thu Apr 3 15:07:08 2014 -0400
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Apr 4 09:28:09 2014 +0100

    xenctx: Add 16 bit output
    
    This output happens on !guest_protected_mode.  The cpu is in 16 bit
    mode in this case.
    
    For example:
    
    $ xenctx 4
    cs:eip: f000:0000d61b
    flags: 00000002 nz
    ss:esp: 0000:00001fee
    eax: 0000ffc2   ebx: 00000049   ecx: 00000049   edx: ffffffff
    esi: 00000000   edi: 00000010   ebp: 00001ff0
     ds:     e000    es:     0040    fs:     0000    gs:     0000
    Code (instr addr 000fd61b)
    04 67 66 8b 70 08 67 66 8b 68 0c 67 66 8b 58 10 67 66 8b 50 14 <67> 66 8b 
48 18 67 8e 40 02 67 ff
    
    Stack:
     8e30 0000 0246 812f 0000 0206 80e7 0080 0080
    
    $ xenctx 4 -d 0x00001fee -m 0x00001fee -l 1
    Memory (address 1fee):
     8e30 0000 0246 812f 0000 0206 80e7 0080 0080 c2c2 c2c2 c2c2 c2c2 c2c2 c2c2 
c2c2
    
    Stack:
     8e30 0000 0246 812f 0000 0206 80e7 0080 0080
    
    Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/xentrace/xenctx.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/xentrace/xenctx.c b/tools/xentrace/xenctx.c
index 3804bd3..6655990 100644
--- a/tools/xentrace/xenctx.c
+++ b/tools/xentrace/xenctx.c
@@ -47,6 +47,7 @@ typedef enum type_of_addr_ {
 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_16B_WORD "%04llx"
 #define FMT_32B_WORD "%08llx"
 #define FMT_64B_WORD "%016llx"
 /* Word-length of the guest's own data structures */
@@ -57,11 +58,13 @@ int guest_protected_mode = 1;
 #elif defined(__arm__)
 #define NO_TRANSLATION
 typedef uint64_t guest_word_t;
+#define FMT_16B_WORD "%04llx"
 #define FMT_32B_WORD "%08llx"
 #define FMT_64B_WORD "%016llx"
 #elif defined(__aarch64__)
 #define NO_TRANSLATION
 typedef uint64_t guest_word_t;
+#define FMT_16B_WORD "%04llx"
 #define FMT_32B_WORD "%08llx"
 #define FMT_64B_WORD "%016llx"
 #endif
@@ -479,7 +482,7 @@ static void print_ctx(vcpu_guest_context_any_t *ctx)
 {
     if (ctxt_word_size == 4)
         print_ctx_32(&ctx->x32);
-    else if (guest_word_size == 4)
+    else if (guest_word_size != 8)
         print_ctx_32on64(&ctx->x64);
     else
         print_ctx_64(&ctx->x64);
@@ -749,7 +752,9 @@ static guest_word_t read_mem_word(vcpu_guest_context_any_t 
*ctx, int vcpu,
 
 static void print_stack_word(guest_word_t word, int width)
 {
-    if (width == 4)
+    if (width == 2)
+        printf(FMT_16B_WORD, word);
+    else if (width == 4)
         printf(FMT_32B_WORD, word);
     else
         printf(FMT_64B_WORD, word);
@@ -984,8 +989,9 @@ static void dump_ctx(int vcpu)
                 perror("xc_domain_hvm_getcontext_partial");
                 return;
             }
-            guest_word_size = (cpuctx.msr_efer & 0x400) ? 8 : 4;
             guest_protected_mode = (cpuctx.cr0 & CR0_PE);
+            guest_word_size = (cpuctx.msr_efer & 0x400) ? 8 :
+                guest_protected_mode ? 4 : 2;
             /* HVM guest context records are always host-sized */
             if (xc_version(xenctx.xc_handle, XENVER_capabilities, &xen_caps) 
!= 0) {
                 perror("xc_version");
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.