mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
hw/xen: Add foreignmem operations to allow redirection to internal emulation
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
parent
f80fad16af
commit
15e283c5b6
7 changed files with 88 additions and 26 deletions
|
@ -214,6 +214,32 @@ static inline int qemu_xen_gnttab_unmap(xengnttab_handle *xgt,
|
|||
return xen_gnttab_ops->unmap(xgt, start_address, refs, count);
|
||||
}
|
||||
|
||||
struct foreignmem_backend_ops {
|
||||
void *(*map)(uint32_t dom, void *addr, int prot, size_t pages,
|
||||
xen_pfn_t *pfns, int *errs);
|
||||
int (*unmap)(void *addr, size_t pages);
|
||||
};
|
||||
|
||||
extern struct foreignmem_backend_ops *xen_foreignmem_ops;
|
||||
|
||||
static inline void *qemu_xen_foreignmem_map(uint32_t dom, void *addr, int prot,
|
||||
size_t pages, xen_pfn_t *pfns,
|
||||
int *errs)
|
||||
{
|
||||
if (!xen_foreignmem_ops) {
|
||||
return NULL;
|
||||
}
|
||||
return xen_foreignmem_ops->map(dom, addr, prot, pages, pfns, errs);
|
||||
}
|
||||
|
||||
static inline int qemu_xen_foreignmem_unmap(void *addr, size_t pages)
|
||||
{
|
||||
if (!xen_foreignmem_ops) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
return xen_foreignmem_ops->unmap(addr, pages);
|
||||
}
|
||||
|
||||
void setup_xen_backend_ops(void);
|
||||
|
||||
#endif /* QEMU_XEN_BACKEND_OPS_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue