[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 1/4] public: Add page related definitions for accessing guests memory
These changes introduce the page related definitions needed for mapping and accessing guests memory. These values are intended to be used by any toolstack component that needs to map guests memory. Until now, the values were defined by the xenctrl.h header, therefore whenever a component had to use them it also had to add a dependency for the xenctrl library. This patch also introduces xen_mk_long() macrodefinition for defining long constants both for C and assembler code. Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx> --- xen/include/public/page.h | 36 ++++++++++++++++++++++++++++++++++++ xen/include/public/xen.h | 3 +++ 2 files changed, 39 insertions(+) create mode 100644 xen/include/public/page.h diff --git a/xen/include/public/page.h b/xen/include/public/page.h new file mode 100644 index 0000000000..6b06259bad --- /dev/null +++ b/xen/include/public/page.h @@ -0,0 +1,36 @@ +/****************************************************************************** + * page.h + * + * Page definitions for accessing guests memory + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright (c) 2021, Costin Lupu + */ + +#ifndef __XEN_PUBLIC_PAGE_H__ +#define __XEN_PUBLIC_PAGE_H__ + +#include "xen.h" + +#define XEN_PAGE_SHIFT 12 +#define XEN_PAGE_SIZE (xen_mk_long(1) << XEN_PAGE_SHIFT) +#define XEN_PAGE_MASK (~(XEN_PAGE_SIZE - 1)) + +#endif /* __XEN_PUBLIC_PAGE_H__ */ diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index e373592c33..12531c02b5 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -64,11 +64,13 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); /* Turn a plain number into a C unsigned (long (long)) constant. */ #define __xen_mk_uint(x) x ## U +#define __xen_mk_long(x) x ## L #define __xen_mk_ulong(x) x ## UL #ifndef __xen_mk_ullong # define __xen_mk_ullong(x) x ## ULL #endif #define xen_mk_uint(x) __xen_mk_uint(x) +#define xen_mk_long(x) __xen_mk_long(x) #define xen_mk_ulong(x) __xen_mk_ulong(x) #define xen_mk_ullong(x) __xen_mk_ullong(x) @@ -76,6 +78,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); /* In assembly code we cannot use C numeric constant suffixes. */ #define xen_mk_uint(x) x +#define xen_mk_long(x) x #define xen_mk_ulong(x) x #define xen_mk_ullong(x) x -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |