WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: Fix xentrace of hypercalls in debug

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Fix xentrace of hypercalls in debug builds of Xen.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Oct 2007 15:03:41 -0700
Delivery-date: Wed, 31 Oct 2007 15:04:08 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1193128866 -3600
# Node ID 4970cbf9b19e751c7bc79107bd354bc1403d074f
# Parent  5a213170b06e0739b4c8914eedee5530d55a6bb7
x86: Fix xentrace of hypercalls in debug builds of Xen.

Based on a patch by Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/x86_32/entry.S        |    5 ++++-
 xen/arch/x86/x86_64/compat/entry.S |   17 ++++++++++-------
 xen/arch/x86/x86_64/entry.S        |   18 +++++++++++-------
 3 files changed, 25 insertions(+), 15 deletions(-)

diff -r 5a213170b06e -r 4970cbf9b19e xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S       Tue Oct 23 09:31:03 2007 +0100
+++ b/xen/arch/x86/x86_32/entry.S       Tue Oct 23 09:41:06 2007 +0100
@@ -181,6 +181,7 @@ 1:      sti
         movl  $0xDEADBEEF,%eax
         rep   stosl
         movl  %esi,%eax
+#define SHADOW_BYTES 32 /* 6 shadow parameters + EIP + hypercall # */
 #else
         /* 
          * We need shadow parameters even on non-debug builds. We depend on the
@@ -193,12 +194,14 @@ 1:      sti
         pushl 20(%esp) # EDX
         pushl 20(%esp) # ECX
         pushl 20(%esp) # EBX
+#define SHADOW_BYTES 24 /* 6 shadow parameters */
 #endif
         cmpb  $0,tb_init_done
         je    tracing_off
         call  trace_hypercall
         /* Now restore all the registers that trace_hypercall clobbered */
-        movl  UREGS_eax+24(%esp),%eax /* Hypercall # */
+        movl  UREGS_eax+SHADOW_BYTES(%esp),%eax /* Hypercall # */
+#undef SHADOW_BYTES
 tracing_off:
         call *hypercall_table(,%eax,4)
         addl  $24,%esp     # Discard the shadow parameters
diff -r 5a213170b06e -r 4970cbf9b19e xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Tue Oct 23 09:31:03 2007 +0100
+++ b/xen/arch/x86/x86_64/compat/entry.S        Tue Oct 23 09:41:06 2007 +0100
@@ -47,6 +47,7 @@ ENTRY(compat_hypercall)
         movl  UREGS_rax(%rsp),%eax
         pushq %rax
         pushq UREGS_rip+8(%rsp)
+#define SHADOW_BYTES 16 /* Shadow EIP + shadow hypercall # */
 #else
         /* Relocate argument registers and zero-extend to 64 bits. */
         movl  %eax,%eax              /* Hypercall #  */
@@ -55,18 +56,20 @@ ENTRY(compat_hypercall)
         movl  %edi,%r8d              /* Arg 5        */
         movl  %ebp,%r9d              /* Arg 6        */
         movl  UREGS_rbx(%rsp),%edi   /* Arg 1        */
+#define SHADOW_BYTES 0  /* No on-stack shadow state */
 #endif
         cmpb  $0,tb_init_done(%rip)
         je    compat_tracing_off
         call  trace_hypercall
         /* Now restore all the registers that trace_hypercall clobbered */
-        movl  UREGS_rax(%rsp),%eax   /* Hypercall #  */
-        movl  UREGS_rbx(%rsp),%edi   /* Arg 1        */
-        movl  UREGS_rcx(%rsp),%esi   /* Arg 2        */
-        movl  UREGS_rdx(%rsp),%edx   /* Arg 3        */
-        movl  UREGS_rsi(%rsp),%ecx   /* Arg 4        */
-        movl  UREGS_rdi(%rsp),%r8d   /* Arg 5        */
-        movl  UREGS_rbp(%rsp),%r9d   /* Arg 6        */
+        movl  UREGS_rax+SHADOW_BYTES(%rsp),%eax   /* Hypercall #  */
+        movl  UREGS_rbx+SHADOW_BYTES(%rsp),%edi   /* Arg 1        */
+        movl  UREGS_rcx+SHADOW_BYTES(%rsp),%esi   /* Arg 2        */
+        movl  UREGS_rdx+SHADOW_BYTES(%rsp),%edx   /* Arg 3        */
+        movl  UREGS_rsi+SHADOW_BYTES(%rsp),%ecx   /* Arg 4        */
+        movl  UREGS_rdi+SHADOW_BYTES(%rsp),%r8d   /* Arg 5        */
+        movl  UREGS_rbp+SHADOW_BYTES(%rsp),%r9d   /* Arg 6        */
+#undef SHADOW_BYTES
 compat_tracing_off:
         leaq  compat_hypercall_table(%rip),%r10
         PERFC_INCR(PERFC_hypercalls, %rax, %rbx)
diff -r 5a213170b06e -r 4970cbf9b19e xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S       Tue Oct 23 09:31:03 2007 +0100
+++ b/xen/arch/x86/x86_64/entry.S       Tue Oct 23 09:41:06 2007 +0100
@@ -148,18 +148,22 @@ ENTRY(syscall_enter)
         movq  UREGS_rax(%rsp),%rax
         pushq %rax
         pushq UREGS_rip+8(%rsp)
+#define SHADOW_BYTES 16 /* Shadow EIP + shadow hypercall # */
+#else
+#define SHADOW_BYTES 0  /* No on-stack shadow state */
 #endif
         cmpb  $0,tb_init_done(%rip)
         je    tracing_off
         call  trace_hypercall
         /* Now restore all the registers that trace_hypercall clobbered */
-        movq  UREGS_rax(%rsp),%rax   /* Hypercall #  */
-        movq  UREGS_rdi(%rsp),%rdi   /* Arg 1        */
-        movq  UREGS_rsi(%rsp),%rsi   /* Arg 2        */
-        movq  UREGS_rdx(%rsp),%rdx   /* Arg 3        */
-        movq  UREGS_r10(%rsp),%rcx   /* Arg 4        */
-        movq  UREGS_rdi(%rsp),%r8    /* Arg 5        */
-        movq  UREGS_rbp(%rsp),%r9    /* Arg 6        */
+        movq  UREGS_rax+SHADOW_BYTES(%rsp),%rax   /* Hypercall #  */
+        movq  UREGS_rdi+SHADOW_BYTES(%rsp),%rdi   /* Arg 1        */
+        movq  UREGS_rsi+SHADOW_BYTES(%rsp),%rsi   /* Arg 2        */
+        movq  UREGS_rdx+SHADOW_BYTES(%rsp),%rdx   /* Arg 3        */
+        movq  UREGS_r10+SHADOW_BYTES(%rsp),%rcx   /* Arg 4        */
+        movq  UREGS_rdi+SHADOW_BYTES(%rsp),%r8    /* Arg 5        */
+        movq  UREGS_rbp+SHADOW_BYTES(%rsp),%r9    /* Arg 6        */
+#undef SHADOW_BYTES
 tracing_off:
         leaq  hypercall_table(%rip),%r10
         PERFC_INCR(PERFC_hypercalls, %rax, %rbx)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Fix xentrace of hypercalls in debug builds of Xen., Xen patchbot-unstable <=