repository: /home/avi/kvm
branch: master
commit 9115b6c6dbaecaf1d7ee7cc5ae6b4c026a88f4de
Author: Avi Kivity <[EMAIL PROTECTED]>
Date:   Mon Nov 26 15:06:11 2007 +0200

    kvm: testsuite: add vmap() to be able to map mmio space
    
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/user/test/x86/vm.c b/user/test/x86/vm.c
index e0e78d7..03c7354 100644
--- a/user/test/x86/vm.c
+++ b/user/test/x86/vm.c
@@ -247,3 +247,22 @@ void vfree(void *mem)
        size -= PAGE_SIZE;
     }
 }
+
+void *vmap(unsigned long long phys, unsigned long size)
+{
+    void *mem, *p;
+    unsigned pages;
+
+    size = (size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
+    vfree_top -= size;
+    phys &= ~(unsigned long long)(PAGE_SIZE - 1);
+
+    mem = p = vfree_top;
+    pages = size / PAGE_SIZE;
+    while (pages--) {
+       install_page(phys_to_virt(read_cr3()), phys, p);
+       phys += PAGE_SIZE;
+       p += PAGE_SIZE;
+    }
+    return mem;
+}
diff --git a/user/test/x86/vm.h b/user/test/x86/vm.h
index 336bd00..0a481f1 100644
--- a/user/test/x86/vm.h
+++ b/user/test/x86/vm.h
@@ -5,5 +5,6 @@ void setup_vm();
 
 void *vmalloc(unsigned long size);
 void vfree(void *mem);
+void *vmap(unsigned long long phys, unsigned long size);
 
 #endif

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to