aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/tmem_xen.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-06-17 07:14:02 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-06-17 07:14:02 +0100
commitc93bd0e6ea2a0295f56abd4e58cbb0761f299f0d (patch)
tree50c4f5c7d108184b48a19ba941d56973912990d1 /xen/include/xen/tmem_xen.h
parentc133cc38e21d21f36ae62685e7e64d3e07542814 (diff)
downloadxen-c93bd0e6ea2a0295f56abd4e58cbb0761f299f0d.tar.gz
xen-c93bd0e6ea2a0295f56abd4e58cbb0761f299f0d.tar.bz2
xen-c93bd0e6ea2a0295f56abd4e58cbb0761f299f0d.zip
tmem: fix 32-on-64 support
This implicitly required coverting the tmem_op structure from anonymous to standard struct/union sub-fields, and extending the get-fields.sh helper script to deal with typedef-ed guest handles used as types of translated compound type fields. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/xen/tmem_xen.h')
-rw-r--r--xen/include/xen/tmem_xen.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/xen/include/xen/tmem_xen.h b/xen/include/xen/tmem_xen.h
index 7da18e67e6..aec44ce09e 100644
--- a/xen/include/xen/tmem_xen.h
+++ b/xen/include/xen/tmem_xen.h
@@ -16,6 +16,9 @@
#include <xen/guest_access.h> /* copy_from_guest */
#include <xen/hash.h> /* hash_long */
#include <public/tmem.h>
+#ifdef CONFIG_COMPAT
+#include <compat/tmem.h>
+#endif
struct tmem_host_dependent_client {
struct domain *domain;
@@ -286,6 +289,29 @@ typedef XEN_GUEST_HANDLE(tmem_op_t) tmem_cli_op_t;
static inline int tmh_get_tmemop_from_client(tmem_op_t *op, tmem_cli_op_t uops)
{
+#ifdef CONFIG_COMPAT
+ if ( is_pv_32on64_vcpu(current) )
+ {
+ int rc;
+ enum XLAT_tmem_op_u u;
+ tmem_op_compat_t cop;
+
+ rc = copy_from_guest(&cop, guest_handle_cast(uops, void), 1);
+ if ( rc )
+ return rc;
+ switch ( cop.cmd )
+ {
+ case TMEM_NEW_POOL: u = XLAT_tmem_op_u_new; break;
+ case TMEM_CONTROL: u = XLAT_tmem_op_u_ctrl; break;
+ default: u = XLAT_tmem_op_u_gen; break;
+ }
+#define XLAT_tmem_op_HNDL_u_ctrl_buf(_d_, _s_) \
+ guest_from_compat_handle((_d_)->u.ctrl.buf, (_s_)->u.ctrl.buf)
+ XLAT_tmem_op(op, &cop);
+#undef XLAT_tmem_op_HNDL_u_ctrl_buf
+ return 0;
+ }
+#endif
return copy_from_guest(op, uops, 1);
}