[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 5/7] xen: include xen/guest_access.h rather than asm/guest_access.h
Hi Paul, On 06/04/2020 08:40, Paul Durrant wrote: diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/asm-x86/guest_access.h index 9ee275d01f..5c3dfc47b6 100644 --- a/xen/include/asm-x86/guest_access.h +++ b/xen/include/asm-x86/guest_access.h @@ -54,22 +54,24 @@ /* Cast a XEN_GUEST_HANDLE to XEN_GUEST_HANDLE_PARAM */ #define guest_handle_to_param(hnd, type) ({ \ + typeof((hnd).p) _x = (hnd).p; \ + XEN_GUEST_HANDLE_PARAM(type) _y = { _x }; \ /* type checking: make sure that the pointers inside \ * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ * the same type, then return hnd */ \ - (void)((typeof(&(hnd).p)) 0 == \ - (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ - (hnd); \ + (void)(&_x == &_y.p); \ + _y; \ }) /* Cast a XEN_GUEST_HANDLE_PARAM to XEN_GUEST_HANDLE */ -#define guest_handle_from_param(hnd, type) ({ \ - /* type checking: make sure that the pointers inside \ - * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ - * the same type, then return hnd */ \ - (void)((typeof(&(hnd).p)) 0 == \ - (typeof(&((XEN_GUEST_HANDLE_PARAM(type)) {}).p)) 0); \ - (hnd); \ +#define guest_handle_from_param(hnd, type) ({ \ + typeof((hnd).p) _x = (hnd).p; \ + XEN_GUEST_HANDLE(type) _y = { _x }; \ + /* type checking: make sure that the pointers inside \ + * XEN_GUEST_HANDLE and XEN_GUEST_HANDLE_PARAM are of \ + * the same type, then return hnd */ \ + (void)(&_x == &_y.p); \ + _y; \ })The commit comment would have the reader believe that this patch is just some changes in header file inclusion. These last two hunks are something else so I would suggest they get split out into a separate patch. These two chunks were meant to be squashed in patch #6, but I messed up the rebase. I will fix on the next version. Sorry for that. Cheers, Paul#define guest_handle_for_field(hnd, type, fld) \ diff --git a/xen/lib/x86/private.h b/xen/lib/x86/private.h index b793181464..2d53bd3ced 100644 --- a/xen/lib/x86/private.h +++ b/xen/lib/x86/private.h @@ -4,12 +4,12 @@ #ifdef __XEN__ #include <xen/bitops.h> +#include <xen/guest_access.h> #include <xen/kernel.h> #include <xen/lib.h> #include <xen/nospec.h> #include <xen/types.h> -#include <asm/guest_access.h> #include <asm/msr-index.h> #define copy_to_buffer_offset copy_to_guest_offset -- 2.17.1 -- Julien Grall
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |