[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [v5][PATCH 07/10] xen:x86:: support xc_reserved_device_memory_map in compat case
We also need to make sure xc_reserved_device_memory_map can work in compat case. Mostly refer to that complete xc_reserved_device_memory_map hypercall definition, just work with struct compat_mem_reserved_device_memory_map and struct compat_mem_reserved_device_memory. Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx> --- xen/arch/x86/x86_64/compat/mm.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/mm.c index 69c6195..5758c30 100644 --- a/xen/arch/x86/x86_64/compat/mm.c +++ b/xen/arch/x86/x86_64/compat/mm.c @@ -215,6 +215,46 @@ int compat_arch_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg) break; } + case XENMEM_reserved_device_memory_map: + { + struct compat_mem_reserved_device_memory_map map; + unsigned int i = 0; + static struct compat_mem_reserved_device_memory rmrr_map; + struct acpi_rmrr_unit *rmrr; + + if ( copy_from_guest(&map, arg, 1) ) + return -EFAULT; + + if ( !acpi_rmrr_unit_entries ) + return -ENOENT; + + if ( map.nr_entries < acpi_rmrr_unit_entries ) + { + map.nr_entries = acpi_rmrr_unit_entries; + if ( copy_to_guest(arg, &map, 1) ) + return -EFAULT; + return -ENOBUFS; + } + + map.nr_entries = acpi_rmrr_unit_entries; + + list_for_each_entry( rmrr, &acpi_rmrr_units, list ) + { + rmrr_map.start_pfn = rmrr->base_address >> PAGE_SHIFT; + rmrr_map.nr_pages = PAGE_ALIGN(rmrr->end_address - + rmrr->base_address) / + PAGE_SIZE; + if ( copy_to_compat_offset(map.buffer, i, &rmrr_map, 1) ) + return -EFAULT; + i++; + } + + if ( copy_to_guest(arg, &map, 1) ) + return -EFAULT; + + break; + } + default: rc = -ENOSYS; break; -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |