[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 09/13] libx86: Introduce a helper to deserialise cpuid_policy objects
On Fri, Jul 13, 2018 at 09:03:10PM +0100, Andrew Cooper wrote: > As with the serialise side, Xen's copy_from_guest API is used, with a > compatibility wrapper for the userspace build. > > Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > Signed-off-by: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> > --- > CC: Jan Beulich <JBeulich@xxxxxxxx> > CC: Wei Liu <wei.liu2@xxxxxxxxxx> > CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> > CC: Sergey Dyasli <sergey.dyasli@xxxxxxxxxx> > CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> > > v2: > * Rewrite copy_from_buffer_offset() to avoid multiple evaluation of its > arguments. > * Expand boundary justifications. > --- > xen/common/libx86/cpuid.c | 94 > ++++++++++++++++++++++++++++++++++++++++++ > xen/common/libx86/private.h | 14 +++++++ > xen/include/xen/libx86/cpuid.h | 11 +++++ > 3 files changed, 119 insertions(+) > > diff --git a/xen/common/libx86/cpuid.c b/xen/common/libx86/cpuid.c > index cf7dbd3..73cd574 100644 > --- a/xen/common/libx86/cpuid.c > +++ b/xen/common/libx86/cpuid.c > @@ -123,6 +123,100 @@ int x86_cpuid_copy_to_buffer(const struct cpuid_policy > *p, > return 0; > } > > + > /* > * Local variables: > * mode: C > diff --git a/xen/common/libx86/private.h b/xen/common/libx86/private.h > index e874fb6..dc451d0 100644 > --- a/xen/common/libx86/private.h > +++ b/xen/common/libx86/private.h > @@ -12,6 +12,7 @@ > #include <asm/msr-index.h> > > #define copy_to_buffer_offset copy_to_guest_offset > +#define copy_from_buffer_offset copy_from_guest_offset > > #else > > @@ -44,6 +45,19 @@ static inline bool test_bit(unsigned int bit, const void > *vaddr) > 0; \ > }) > > +/* memcpy(), but with copy_from_guest_offset()'s API. */ > +#define copy_from_buffer_offset(dst, src, index, nr) \ > +({ \ > + const typeof(*(dst)) *src_ = (src); \ Same issue as previous patch here. Also enforcing dst_ and src_ are of the same type would be good. Otherwise: Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx> _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |