From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Tim.Deegan@citrix.com, Ian.Campbell@citrix.com,
stefano.stabellini@eu.citrix.com
Subject: [PATCH 4/5] xen: introduce XEN_GUEST_HANDLE_PARAM
Date: Mon, 6 Aug 2012 15:12:04 +0100 [thread overview]
Message-ID: <1344262325-26598-4-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1208061447130.4645@kaball.uk.xensource.com>
Note: this change does not make any difference on x86 and ia64.
XEN_GUEST_HANDLE_PARAM is going to be used to distinguish guest pointers
stored in memory from guest pointers as hypercall parameters.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/include/asm-arm/guest_access.h | 2 +-
xen/include/public/arch-arm.h | 17 +++++++++++++----
xen/include/public/arch-ia64.h | 1 +
xen/include/public/arch-x86/xen.h | 1 +
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/xen/include/asm-arm/guest_access.h b/xen/include/asm-arm/guest_access.h
index 0fceae6..7a955cb 100644
--- a/xen/include/asm-arm/guest_access.h
+++ b/xen/include/asm-arm/guest_access.h
@@ -30,7 +30,7 @@ unsigned long raw_clear_guest(void *to, unsigned len);
/* Cast a guest handle to the specified type of handle. */
#define guest_handle_cast(hnd, type) ({ \
type *_x = (hnd).p; \
- (XEN_GUEST_HANDLE(type)) { _x }; \
+ (XEN_GUEST_HANDLE(type)) { {_x } }; \
})
#define guest_handle_from_ptr(ptr, type) \
diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
index 2ae6548..d17d645 100644
--- a/xen/include/public/arch-arm.h
+++ b/xen/include/public/arch-arm.h
@@ -51,18 +51,27 @@
#define XEN_HYPERCALL_TAG 0XEA1
+#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
#ifndef __ASSEMBLY__
-#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
- typedef struct { type *p; } __guest_handle_ ## name
+#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
+ typedef struct { type *p; } \
+ __guest_handle_ ## name; \
+ typedef struct { union { type *p; uint64_aligned_t q; }; } \
+ __guest_handle_64_ ## name;
#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
___DEFINE_XEN_GUEST_HANDLE(name, type); \
___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
-#define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name
+#define __XEN_GUEST_HANDLE(name) __guest_handle_64_ ## name
#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
-#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0)
+/* this is going to be changes on 64 bit */
+#define XEN_GUEST_HANDLE_PARAM(name) __guest_handle_ ## name
+#define set_xen_guest_handle_raw(hnd, val) \
+ do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \
+ (hnd).p = val; \
+ } while ( 0 )
#ifdef __XEN_TOOLS__
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
#endif
diff --git a/xen/include/public/arch-ia64.h b/xen/include/public/arch-ia64.h
index c9da5d4..97583ea 100644
--- a/xen/include/public/arch-ia64.h
+++ b/xen/include/public/arch-ia64.h
@@ -47,6 +47,7 @@
#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
#define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
+#define XEN_GUEST_HANDLE_PARAM(name) XEN_GUEST_HANDLE(name)
#define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name)
#define uint64_aligned_t uint64_t
#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0)
diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index 1c186d7..8ee5437 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -44,6 +44,7 @@
#define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
#define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name
#define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
+#define XEN_GUEST_HANDLE_PARAM(name) XEN_GUEST_HANDLE(name)
#define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0)
#ifdef __XEN_TOOLS__
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
--
1.7.2.5
next prev parent reply other threads:[~2012-08-06 14:12 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 14:11 [PATCH 0/5] ARM hypercall ABI: 64 bit ready Stefano Stabellini
2012-08-06 14:12 ` [PATCH 1/5] xen: improve changes to xen_add_to_physmap Stefano Stabellini
2012-08-06 14:24 ` Konrad Rzeszutek Wilk
2012-08-06 14:38 ` Stefano Stabellini
2012-08-06 15:32 ` Jan Beulich
2012-08-06 15:43 ` Stefano Stabellini
2012-08-06 15:54 ` Jan Beulich
2012-08-07 12:27 ` Stefano Stabellini
2012-08-07 12:40 ` Jean Guyader
2012-08-07 13:18 ` Jan Beulich
2012-08-07 17:07 ` Stefano Stabellini
2012-08-08 7:14 ` Jan Beulich
2012-08-08 7:45 ` Ian Campbell
2012-08-08 8:49 ` Jan Beulich
2012-08-08 9:51 ` Stefano Stabellini
2012-08-08 10:03 ` Jean Guyader
2012-08-08 10:08 ` Stefano Stabellini
2012-08-08 14:20 ` David Vrabel
2012-08-08 19:33 ` Jean Guyader
2012-08-07 13:02 ` Jan Beulich
2012-08-07 15:24 ` Ian Jackson
2012-08-07 15:37 ` Jan Beulich
2012-08-11 1:33 ` Mukesh Rathor
2012-08-13 10:43 ` Stefano Stabellini
2012-08-06 14:12 ` [PATCH 2/5] xen/arm: introduce __lshrdi3 and __aeabi_llsr Stefano Stabellini
2012-08-09 9:16 ` Ian Campbell
2012-08-09 9:43 ` Stefano Stabellini
2012-08-06 14:12 ` [PATCH 3/5] xen: few more xen_ulong_t substitutions Stefano Stabellini
2012-08-06 15:38 ` Jan Beulich
2012-08-07 12:08 ` Stefano Stabellini
2012-08-07 12:36 ` Ian Campbell
2012-08-07 13:13 ` Jan Beulich
2012-08-07 13:30 ` Ian Campbell
2012-08-07 12:54 ` Jan Beulich
2012-08-08 7:59 ` Ian Campbell
2012-08-08 12:12 ` Stefano Stabellini
2012-08-08 12:17 ` Ian Campbell
2012-08-08 14:07 ` Jan Beulich
2012-08-08 15:01 ` Stefano Stabellini
2012-08-08 15:12 ` Jan Beulich
2012-08-08 15:55 ` Stefano Stabellini
2012-08-06 14:12 ` Stefano Stabellini [this message]
2012-08-06 15:43 ` [PATCH 4/5] xen: introduce XEN_GUEST_HANDLE_PARAM Jan Beulich
2012-08-06 15:47 ` Ian Campbell
2012-08-06 15:58 ` Jan Beulich
2012-08-06 16:02 ` Stefano Stabellini
2012-08-07 6:24 ` Jan Beulich
2012-08-07 12:35 ` Stefano Stabellini
2012-08-07 12:39 ` Ian Campbell
2012-08-07 13:08 ` Jan Beulich
2012-08-07 18:09 ` Stefano Stabellini
2012-08-08 7:48 ` Ian Campbell
2012-08-08 8:54 ` Jan Beulich
2012-08-06 14:12 ` [PATCH 5/5] xen: replace XEN_GUEST_HANDLE with XEN_GUEST_HANDLE_PARAM when appropriate Stefano Stabellini
2012-08-06 14:39 ` [PATCH 0/5] ARM hypercall ABI: 64 bit ready David Vrabel
2012-08-06 14:44 ` Stefano Stabellini
2012-08-06 14:49 ` Stefano Stabellini
2012-08-06 14:59 ` David Vrabel
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=1344262325-26598-4-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Tim.Deegan@citrix.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).