]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
xenctx: Fix handling of !guest_protected_mode
authorDon Slutz <dslutz@verizon.com>
Thu, 3 Apr 2014 19:07:07 +0000 (15:07 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 4 Apr 2014 08:28:09 +0000 (09:28 +0100)
Start with adding the code to the 64 bit path that the 32 bit path
has.

Next disable the "Stack Trace" or "Call Trace".

Finally allow stack dump.

Signed-off-by: Don Slutz <dslutz@verizon.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/xentrace/xenctx.c

index fa300b5c956d259d5073f64f86530d32a12a406a..3804bd3c8fe2c0dfbc7f5db88003d6255ebc74d7 100644 (file)
@@ -498,8 +498,13 @@ static guest_word_t instr_pointer(vcpu_guest_context_any_t *ctx)
             r += ctx->x32.user_regs.cs << NONPROT_MODE_SEGMENT_SHIFT;
     }
     else
+    {
         r = ctx->x64.user_regs.rip;
 
+        if ( !guest_protected_mode )
+            r += ctx->x64.user_regs.cs << NONPROT_MODE_SEGMENT_SHIFT;
+    }
+
     return r;
 }
 
@@ -514,8 +519,13 @@ static guest_word_t stack_pointer(vcpu_guest_context_any_t *ctx)
             r += ctx->x32.user_regs.ss << NONPROT_MODE_SEGMENT_SHIFT;
     }
     else
+    {
         r = ctx->x64.user_regs.rsp;
 
+        if ( !guest_protected_mode )
+            r += ctx->x64.user_regs.ss << NONPROT_MODE_SEGMENT_SHIFT;
+    }
+
     return r;
 }
 
@@ -865,6 +875,9 @@ static int print_stack(vcpu_guest_context_any_t *ctx, int vcpu, int width,
             return -1;
     }
 
+    if ( !guest_protected_mode )
+        return 0;
+
     if(xenctx.stack_trace)
         printf("Stack Trace:\n");
     else
@@ -1003,7 +1016,8 @@ static void dump_ctx(int vcpu)
 #ifndef NO_TRANSLATION
     if (print_code(&ctx, vcpu))
         return;
-    if ( kernel_addr(instr_pointer(&ctx)) >= KERNEL_TEXT_ADDR )
+    if ( !guest_protected_mode ||
+         kernel_addr(instr_pointer(&ctx)) >= KERNEL_TEXT_ADDR )
         if ( print_stack(&ctx, vcpu, guest_word_size,
                          stack_pointer(&ctx)) )
             return;