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

[Xen-changelog] [xen-unstable] Simplify set_px_info hypercall 32-on-64 compatibility shim.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224672831 -3600
# Node ID 0978bdc056c88144553c2d441611545eced7bc4d
# Parent  02c8733e2d91557a98b6964bfb7e136f0e3924d4
Simplify set_px_info hypercall 32-on-64 compatibility shim.

Mark processor_px as 'checking' and translate handle to simplify
actual code doing in the translation.
(According to Jan Beulich's suggestion)

Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---
 xen/arch/x86/x86_64/cpufreq.c |   33 ++++++---------------------------
 xen/include/xlat.lst          |    2 +-
 2 files changed, 7 insertions(+), 28 deletions(-)

diff -r 02c8733e2d91 -r 0978bdc056c8 xen/arch/x86/x86_64/cpufreq.c
--- a/xen/arch/x86/x86_64/cpufreq.c     Wed Oct 22 17:20:15 2008 +0900
+++ b/xen/arch/x86/x86_64/cpufreq.c     Wed Oct 22 11:53:51 2008 +0100
@@ -56,34 +56,13 @@ compat_set_px_pminfo(uint32_t cpu, struc
        return -EFAULT;
 
 #define XLAT_processor_performance_HNDL_states(_d_, _s_) do { \
-    xen_processor_px_t *xen_states = NULL; \
-\
-    if ( likely((_s_)->state_count > 0) ) \
-    { \
-        XEN_GUEST_HANDLE(compat_processor_px_t) states; \
-        compat_processor_px_t state; \
-        int i; \
-\
-        xen_states = xlat_malloc_array(xlat_page_current, \
-                               xen_processor_px_t, (_s_)->state_count); \
-        if ( unlikely(xen_states == NULL) ) \
-            return -EFAULT; \
-\
-        if ( unlikely(!compat_handle_okay((_s_)->states, \
-                                (_s_)->state_count)) ) \
-            return -EFAULT; \
-        guest_from_compat_handle(states, (_s_)->states); \
-\
-        for ( i = 0; i < _s_->state_count; i++ ) \
-        { \
-           if ( unlikely(copy_from_guest_offset(&state, states, i, 1)) ) \
-               return -EFAULT; \
-           XLAT_processor_px(&xen_states[i], &state); \
-        } \
-    } \
-\
-    set_xen_guest_handle((_d_)->states, xen_states); \
+    XEN_GUEST_HANDLE(compat_processor_px_t) states; \
+    if ( unlikely(!compat_handle_okay((_s_)->states, (_s_)->state_count)) ) \
+        return -EFAULT; \
+    guest_from_compat_handle(states, (_s_)->states); \
+    (_d_)->states = guest_handle_cast(states, xen_processor_px_t); \
 } while (0)
+
     XLAT_processor_performance(xen_perf, perf);
 #undef XLAT_processor_performance_HNDL_states
 
diff -r 02c8733e2d91 -r 0978bdc056c8 xen/include/xlat.lst
--- a/xen/include/xlat.lst      Wed Oct 22 17:20:15 2008 +0900
+++ b/xen/include/xlat.lst      Wed Oct 22 11:53:51 2008 +0100
@@ -56,6 +56,6 @@
 !      processor_flags                 platform.h
 !      processor_power                 platform.h
 !      pct_register                    platform.h
-!      processor_px                    platform.h
+?      processor_px                    platform.h
 !      psd_package                     platform.h
 !      processor_performance           platform.h

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


 


Rackspace

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