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] 32-on-64: Fix compat-access macros to use

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] 32-on-64: Fix compat-access macros to use correct underlying HVM accessors.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Jun 2008 14:10:46 -0700
Delivery-date: Fri, 13 Jun 2008 14:46:05 -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.fraser@xxxxxxxxxx>
# Date 1213369850 -3600
# Node ID ac745ad5f018356b4cf4b1ba127e6c2cc42c4723
# Parent  a88e195267706f048d13333fbfd6af3e15829fcf
32-on-64: Fix compat-access macros to use correct underlying HVM accessors.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/include/asm-x86/guest_access.h |   50 +++++++++++++++++++------------------
 xen/include/xen/compat.h           |   16 +++++------
 2 files changed, 34 insertions(+), 32 deletions(-)

diff -r a88e19526770 -r ac745ad5f018 xen/include/asm-x86/guest_access.h
--- a/xen/include/asm-x86/guest_access.h        Fri Jun 13 15:31:35 2008 +0100
+++ b/xen/include/asm-x86/guest_access.h        Fri Jun 13 16:10:50 2008 +0100
@@ -11,6 +11,24 @@
 #include <asm/shadow.h>
 #include <asm/hvm/support.h>
 #include <asm/hvm/guest_access.h>
+
+/* Raw access functions: no type checking. */
+#define raw_copy_to_guest(dst, src, len)        \
+    (is_hvm_vcpu(current) ?                     \
+     copy_to_user_hvm((dst), (src), (len)) :    \
+     copy_to_user((dst), (src), (len)))
+#define raw_copy_from_guest(dst, src, len)      \
+    (is_hvm_vcpu(current) ?                     \
+     copy_from_user_hvm((dst), (src), (len)) :  \
+     copy_from_user((dst), (src), (len)))
+#define __raw_copy_to_guest(dst, src, len)      \
+    (is_hvm_vcpu(current) ?                     \
+     copy_to_user_hvm((dst), (src), (len)) :    \
+     __copy_to_user((dst), (src), (len)))
+#define __raw_copy_from_guest(dst, src, len)    \
+    (is_hvm_vcpu(current) ?                     \
+     copy_from_user_hvm((dst), (src), (len)) :  \
+     __copy_from_user((dst), (src), (len)))
 
 /* Is the guest handle a NULL reference? */
 #define guest_handle_is_null(hnd)        ((hnd).p == NULL)
@@ -36,9 +54,7 @@
     const typeof(*(ptr)) *_s = (ptr);                   \
     char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
     ((void)((hnd).p == (ptr)));                         \
-    is_hvm_vcpu(current) ?                              \
-    copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) :  \
-    copy_to_user(_d+(off), _s, sizeof(*_s)*(nr));       \
+    raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));  \
 })
 
 /*
@@ -48,9 +64,7 @@
 #define copy_from_guest_offset(ptr, hnd, off, nr) ({    \
     const typeof(*(ptr)) *_s = (hnd).p;                 \
     typeof(*(ptr)) *_d = (ptr);                         \
-    is_hvm_vcpu(current) ?                              \
-    copy_from_user_hvm(_d, _s+(off), sizeof(*_d)*(nr)) :\
-    copy_from_user(_d, _s+(off), sizeof(*_d)*(nr));     \
+    raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
 })
 
 /* Copy sub-field of a structure to guest context via a guest handle. */
@@ -58,18 +72,14 @@
     const typeof(&(ptr)->field) _s = &(ptr)->field;     \
     void *_d = &(hnd).p->field;                         \
     ((void)(&(hnd).p->field == &(ptr)->field));         \
-    is_hvm_vcpu(current) ?                              \
-    copy_to_user_hvm(_d, _s, sizeof(*_s)) :             \
-    copy_to_user(_d, _s, sizeof(*_s));                  \
+    raw_copy_to_guest(_d, _s, sizeof(*_s));             \
 })
 
 /* Copy sub-field of a structure from guest context via a guest handle. */
 #define copy_field_from_guest(ptr, hnd, field) ({       \
     const typeof(&(ptr)->field) _s = &(hnd).p->field;   \
     typeof(&(ptr)->field) _d = &(ptr)->field;           \
-    is_hvm_vcpu(current) ?                              \
-    copy_from_user_hvm(_d, _s, sizeof(*_d)) :           \
-    copy_from_user(_d, _s, sizeof(*_d));                \
+    raw_copy_from_guest(_d, _s, sizeof(*_d));           \
 })
 
 /*
@@ -89,34 +99,26 @@
     const typeof(*(ptr)) *_s = (ptr);                   \
     char (*_d)[sizeof(*_s)] = (void *)(hnd).p;          \
     ((void)((hnd).p == (ptr)));                         \
-    is_hvm_vcpu(current) ?                              \
-    copy_to_user_hvm(_d+(off), _s, sizeof(*_s)*(nr)) :  \
-    __copy_to_user(_d+(off), _s, sizeof(*_s)*(nr));     \
+    __raw_copy_to_guest(_d+(off), _s, sizeof(*_s)*(nr));\
 })
 
 #define __copy_from_guest_offset(ptr, hnd, off, nr) ({  \
     const typeof(*(ptr)) *_s = (hnd).p;                 \
     typeof(*(ptr)) *_d = (ptr);                         \
-    is_hvm_vcpu(current) ?                              \
-    copy_from_user_hvm(_d, _s+(off), sizeof(*_d)*(nr)) :\
-    __copy_from_user(_d, _s+(off), sizeof(*_d)*(nr));   \
+    __raw_copy_from_guest(_d, _s+(off), sizeof(*_d)*(nr));\
 })
 
 #define __copy_field_to_guest(hnd, ptr, field) ({       \
     const typeof(&(ptr)->field) _s = &(ptr)->field;     \
     void *_d = &(hnd).p->field;                         \
     ((void)(&(hnd).p->field == &(ptr)->field));         \
-    is_hvm_vcpu(current) ?                              \
-    copy_to_user_hvm(_d, _s, sizeof(*_s)) :             \
-    __copy_to_user(_d, _s, sizeof(*_s));                \
+    __raw_copy_to_guest(_d, _s, sizeof(*_s));           \
 })
 
 #define __copy_field_from_guest(ptr, hnd, field) ({     \
     const typeof(&(ptr)->field) _s = &(hnd).p->field;   \
     typeof(&(ptr)->field) _d = &(ptr)->field;           \
-    is_hvm_vcpu(current) ?                              \
-    copy_from_user_hvm(_d, _s, sizeof(*_d)) :           \
-    __copy_from_user(_d, _s, sizeof(*_d));              \
+    __raw_copy_from_guest(_d, _s, sizeof(*_d));         \
 })
 
 #endif /* __ASM_X86_GUEST_ACCESS_H__ */
diff -r a88e19526770 -r ac745ad5f018 xen/include/xen/compat.h
--- a/xen/include/xen/compat.h  Fri Jun 13 15:31:35 2008 +0100
+++ b/xen/include/xen/compat.h  Fri Jun 13 16:10:50 2008 +0100
@@ -47,7 +47,7 @@
     const typeof(*(ptr)) *_s = (ptr);                                \
     char (*_d)[sizeof(*_s)] = (void *)(full_ptr_t)(hnd).c;           \
     ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr)));     \
-    copy_to_user(_d + (off), _s, sizeof(*_s) * (nr));                \
+    raw_copy_to_guest(_d + (off), _s, sizeof(*_s) * (nr));           \
 })
 
 /*
@@ -57,7 +57,7 @@
 #define copy_from_compat_offset(ptr, hnd, off, nr) ({                \
     const typeof(*(ptr)) *_s = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
     typeof(*(ptr)) *_d = (ptr);                                      \
-    copy_from_user(_d, _s + (off), sizeof(*_d) * (nr));              \
+    raw_copy_from_guest(_d, _s + (off), sizeof(*_d) * (nr));         \
 })
 
 #define copy_to_compat(hnd, ptr, nr)                                 \
@@ -72,7 +72,7 @@
     void *_d = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field;   \
     ((void)(&((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field ==    \
             &(ptr)->field));                                         \
-    copy_to_user(_d, _s, sizeof(*_s));                               \
+    raw_copy_to_guest(_d, _s, sizeof(*_s));                          \
 })
 
 /* Copy sub-field of a structure from guest context via a compat handle. */
@@ -80,7 +80,7 @@
     const typeof(&(ptr)->field) _s =                                 \
         &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field;          \
     typeof(&(ptr)->field) _d = &(ptr)->field;                        \
-    copy_from_user(_d, _s, sizeof(*_d));                             \
+    raw_copy_from_guest(_d, _s, sizeof(*_d));                        \
 })
 
 /*
@@ -95,13 +95,13 @@
     const typeof(*(ptr)) *_s = (ptr);                                \
     char (*_d)[sizeof(*_s)] = (void *)(full_ptr_t)(hnd).c;           \
     ((void)((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c == (ptr)));     \
-    __copy_to_user(_d + (off), _s, sizeof(*_s) * (nr));              \
+    __raw_copy_to_guest(_d + (off), _s, sizeof(*_s) * (nr));         \
 })
 
 #define __copy_from_compat_offset(ptr, hnd, off, nr) ({              \
     const typeof(*(ptr)) *_s = (typeof(**(hnd)._) *)(full_ptr_t)(hnd).c; \
     typeof(*(ptr)) *_d = (ptr);                                      \
-    __copy_from_user(_d, _s + (off), sizeof(*_d) * (nr));            \
+    __raw_copy_from_guest(_d, _s + (off), sizeof(*_d) * (nr));       \
 })
 
 #define __copy_to_compat(hnd, ptr, nr)                               \
@@ -115,14 +115,14 @@
     void *_d = &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field;   \
     ((void)(&((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field ==    \
             &(ptr)->field));                                         \
-    __copy_to_user(_d, _s, sizeof(*_s));                             \
+    __raw_copy_to_guest(_d, _s, sizeof(*_s));                        \
 })
 
 #define __copy_field_from_compat(ptr, hnd, field) ({                 \
     const typeof(&(ptr)->field) _s =                                 \
         &((typeof(**(hnd)._) *)(full_ptr_t)(hnd).c)->field;          \
     typeof(&(ptr)->field) _d = &(ptr)->field;                        \
-    __copy_from_user(_d, _s, sizeof(*_d));                           \
+    __raw_copy_from_guest(_d, _s, sizeof(*_d));                      \
 })
 
 

_______________________________________________
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] 32-on-64: Fix compat-access macros to use correct underlying HVM accessors., Xen patchbot-unstable <=