All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Sharma <arun.sharma@intel.com>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>,
	Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] vmx-gdbserver-paging.patch
Date: Fri, 17 Jun 2005 16:45:06 -0700	[thread overview]
Message-ID: <20050617234506.GA7901@intel.com> (raw)

gdbserver should not try to convert guest physical to machine physical if
paging is not enabled.

Signed-off-by: Arun Sharma <arun.sharma@intel.com>

--- a/xen/include/public/arch-x86_32.h	Thu Jun 16 22:46:01 2005
+++ b/xen/include/public/arch-x86_32.h	Thu Jun 16 23:49:22 2005
@@ -134,6 +134,8 @@
     unsigned long gdt_frames[16], gdt_ents; /* GDT (machine frames, # ents) */
     unsigned long kernel_ss, kernel_sp;     /* Virtual TSS (only SS1/SP1)   */
     unsigned long pt_base;                  /* CR3 (pagetable base)         */
+    unsigned long cr0;                      /* CR0                          */
+    unsigned long cr4;                      /* CR4                          */
     unsigned long debugreg[8];              /* DB0-DB7 (debug registers)    */
     unsigned long event_callback_cs;        /* CS:EIP of event callback     */
     unsigned long event_callback_eip;
--- a/tools/libxc/xc_ptrace.c	Thu Jun 16 22:46:01 2005
+++ b/tools/libxc/xc_ptrace.c	Thu Jun 16 23:49:22 2005
@@ -3,6 +3,8 @@
 #include "xc_private.h"
 #include <time.h>
 
+#define X86_CR0_PE              0x00000001 /* Enable Protected Mode    (RW) */
+#define X86_CR0_PG              0x80000000 /* Paging                   (RW) */
 
 #define BSD_PAGE_MASK	(PAGE_SIZE-1)
 #define	PG_FRAME	(~((unsigned long)BSD_PAGE_MASK)
@@ -132,6 +134,13 @@
 static unsigned long            cr3[MAX_VIRT_CPUS];
 static vcpu_guest_context_t ctxt[MAX_VIRT_CPUS];
 
+static inline int paging_enabled(vcpu_guest_context_t *v)
+{
+    unsigned long cr0 = v->cr0;
+
+    return (cr0 & X86_CR0_PE) && (cr0 & X86_CR0_PG);
+}
+
 /* --------------------- */
 
 static void *
@@ -179,7 +188,7 @@
     } 
     if ((pde = cr3_virt[cpu][vtopdi(va)]) == 0) /* logical address */
 	goto error_out;
-    if (ctxt[cpu].flags & VGCF_VMX_GUEST)
+    if ((ctxt[cpu].flags & VGCF_VMX_GUEST) && paging_enabled(&ctxt[cpu]))
         pde = page_array[pde >> PAGE_SHIFT] << PAGE_SHIFT;
     if (pde != pde_phys[cpu]) 
     {
--- a/xen/arch/x86/dom0_ops.c	Thu Jun 16 22:46:01 2005
+++ b/xen/arch/x86/dom0_ops.c	Thu Jun 16 23:49:22 2005
@@ -393,8 +393,11 @@
 
 #ifdef __i386__
 #ifdef CONFIG_VMX
-    if ( VMX_DOMAIN(v) )
+    if ( VMX_DOMAIN(v) ) {
         save_vmx_cpu_user_regs(&c->user_regs);
+        __vmread(CR0_READ_SHADOW, &c->cr0);
+        __vmread(CR4_READ_SHADOW, &c->cr4);
+    }
 #endif
 #endif

                 reply	other threads:[~2005-06-17 23:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20050617234506.GA7901@intel.com \
    --to=arun.sharma@intel.com \
    --cc=Ian.Pratt@cl.cam.ac.uk \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.