Re: [PATCH] Add ability to drop pages through testdev

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

 



On Wed, Dec 29, 2010 at 11:50:48AM +0200, Avi Kivity wrote:
> On 12/22/2010 05:18 PM, Gleb Natapov wrote:
> >Signed-off-by: Gleb Natapov<gleb@xxxxxxxxxx>
> >diff --git a/hw/testdev.c b/hw/testdev.c
> >index d1abf59..29df385 100644
> >--- a/hw/testdev.c
> >+++ b/hw/testdev.c
> >@@ -1,3 +1,4 @@
> >+#include<sys/mman.h>
> >  #include "hw.h"
> >  #include "qdev.h"
> >  #include "isa.h"
> >@@ -46,6 +47,16 @@ static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
> >      return test_device_ioport_data;
> >  }
> >
> >+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
> >+{
> >+    target_phys_addr_t len = 4096;
> >+    void *a = cpu_physical_memory_map(data&  ~0xffful,&len, 0);
> >+
> >+    mprotect(a, 4096, PROT_NONE);
> >+    mprotect(a, 4096, PROT_READ|PROT_WRITE);
> >+    cpu_physical_memory_unmap(a, len, 0, 0);
> >+}
> >+
> 
> Icky.  This is much better done through the api tests.  Applied it
> so as not to spoil all the effort.
> 
How would you do that there?

--
			Gleb.
--
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