[PATCH kvm-unit-tests 1/2] vm: add alloc_vpages()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allows allocating contiguous virtual address space.

Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
---
 lib/x86/vm.c |    9 +++++++--
 lib/x86/vm.h |    1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index abbb0c9..550ec9b 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -249,8 +249,13 @@ void *vmap(unsigned long long phys, unsigned long size)
     return mem;
 }
 
-void *alloc_vpage(void)
+void *alloc_vpages(ulong nr)
 {
-	vfree_top -= PAGE_SIZE;
+	vfree_top -= PAGE_SIZE * nr;
 	return vfree_top;
 }
+
+void *alloc_vpage(void)
+{
+    return alloc_vpages(1);
+}
diff --git a/lib/x86/vm.h b/lib/x86/vm.h
index bf8fd52..71ab4a8 100644
--- a/lib/x86/vm.h
+++ b/lib/x86/vm.h
@@ -21,6 +21,7 @@ void *vmalloc(unsigned long size);
 void vfree(void *mem);
 void *vmap(unsigned long long phys, unsigned long size);
 void *alloc_vpage(void);
+void *alloc_vpages(ulong nr);
 
 void install_pte(unsigned long *cr3,
                         int pte_level,
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux