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

[Xen-devel] [PATCH v1] arch/x86: Add registers to vm_event



This patch adds a couple of regs to the vm_event that are used by
the introspection. The base, limit and ar
bits are compressed into a uint64_t union so as not to enlarge the
vm_event.

Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>
---
 xen/arch/x86/vm_event.c       | 35 ++++++++++++++++++++++++++++++++---
 xen/include/public/vm_event.h | 29 +++++++++++++++++++++++++----
 2 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 15de43c3e6..288da0087f 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -171,13 +171,42 @@ void vm_event_fill_regs(vm_event_request_t *req)
     req->data.regs.x86.msr_lstar = ctxt.msr_lstar;
 
     hvm_get_segment_register(curr, x86_seg_fs, &seg);
-    req->data.regs.x86.fs_base = seg.base;
+    req->data.regs.x86.fs.fields.base = seg.base;
+    req->data.regs.x86.fs.fields.limit = seg.limit;
+    req->data.regs.x86.fs.fields.ar = seg.attr;
+    req->data.regs.x86.fs_sel = seg.sel;
 
     hvm_get_segment_register(curr, x86_seg_gs, &seg);
-    req->data.regs.x86.gs_base = seg.base;
+    req->data.regs.x86.gs.fields.base = seg.base;
+    req->data.regs.x86.gs.fields.limit = seg.limit;
+    req->data.regs.x86.gs.fields.ar = seg.attr;
+    req->data.regs.x86.gs_sel = seg.sel;
 
     hvm_get_segment_register(curr, x86_seg_cs, &seg);
-    req->data.regs.x86.cs_arbytes = seg.attr;
+    req->data.regs.x86.cs.fields.base = seg.base;
+    req->data.regs.x86.cs.fields.limit = seg.limit;
+    req->data.regs.x86.cs.fields.ar = seg.attr;
+    req->data.regs.x86.cs_sel = seg.sel;
+
+    hvm_get_segment_register(curr, x86_seg_ss, &seg);
+    req->data.regs.x86.ss.fields.base = seg.base;
+    req->data.regs.x86.ss.fields.limit = seg.limit;
+    req->data.regs.x86.ss.fields.ar = seg.attr;
+    req->data.regs.x86.ss_sel = seg.sel;
+
+    hvm_get_segment_register(curr, x86_seg_ds, &seg);
+    req->data.regs.x86.ds.fields.base = seg.base;
+    req->data.regs.x86.ds.fields.limit = seg.limit;
+    req->data.regs.x86.ds.fields.ar = seg.attr;
+    req->data.regs.x86.ds_sel = seg.sel;
+
+    hvm_get_segment_register(curr, x86_seg_es, &seg);
+    req->data.regs.x86.es.fields.base = seg.base;
+    req->data.regs.x86.es.fields.limit = seg.limit;
+    req->data.regs.x86.es.fields.ar = seg.attr;
+    req->data.regs.x86.es_sel = seg.sel;
+
+    req->data.regs.x86.shadow_gs = ctxt.shadow_gs;
 #endif
 }
 
diff --git a/xen/include/public/vm_event.h b/xen/include/public/vm_event.h
index 36e3f4685d..c6fe96f6a9 100644
--- a/xen/include/public/vm_event.h
+++ b/xen/include/public/vm_event.h
@@ -29,7 +29,7 @@
 
 #include "xen.h"
 
-#define VM_EVENT_INTERFACE_VERSION 0x00000003
+#define VM_EVENT_INTERFACE_VERSION 0x00000004
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 
@@ -157,6 +157,17 @@
 #define VM_EVENT_X86_CR4    2
 #define VM_EVENT_X86_XCR0   3
 
+typedef union
+{
+    uint64_t bytes;
+    struct
+    {
+        uint64_t base   :    32;
+        uint64_t limit  :    20;
+        uint64_t ar     :    12;
+    } fields;
+} x86_selector_reg_t;
+
 /*
  * Using custom vCPU structs (i.e. not hvm_hw_cpu) for both x86 and ARM
  * so as to not fill the vm_event ring buffer too quickly.
@@ -191,9 +202,19 @@ struct vm_event_regs_x86 {
     uint64_t msr_efer;
     uint64_t msr_star;
     uint64_t msr_lstar;
-    uint64_t fs_base;
-    uint64_t gs_base;
-    uint32_t cs_arbytes;
+    x86_selector_reg_t cs;
+    x86_selector_reg_t ss;
+    x86_selector_reg_t ds;
+    x86_selector_reg_t es;
+    x86_selector_reg_t fs;
+    x86_selector_reg_t gs;
+    uint16_t cs_sel;
+    uint16_t ss_sel;
+    uint16_t ds_sel;
+    uint16_t es_sel;
+    uint16_t fs_sel;
+    uint16_t gs_sel;
+    uint64_t shadow_gs;
     uint32_t _pad;
 };
 
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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