[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V2] mem_event: Allow emulating an instruction that caused a page fault
At 16:45 +0200 on 22 Jan (1358873134), Razvan Cojocaru wrote: > >The only properly safe way to allow exactly one exception to your rules > >is to emulate the instruction in user-space. (Well, that or somehow > >move your policy into Xen and do the emulation there, but I'm quite > >strongly opposed to that). > > Is there an example of that somewhere in the Xen source code tree? I don't think so. It occurs to me that if you're willing to rely on the Xen x86_emulate() emulator, the model that we use for emulated MMIO might be better. There, Xen emulates the instruction directly in the fault handler and sends individual memory accesses to qemu for emulation. qemu receives them as a series of ioreqs (basically, address/size/data tuples). So you could, for example: - invent up a new p2m type (probably based very closely on p2m_ram_ro, maybe you could even just use p2m_ram_ro). - Use the HVMOP_set_mem_type to mark the pages you want readonly. - Use Julien Grall's new ioreq interfaces to register your helper as the handler for the pages you care about. Then your user-space helper will get told about each actual write, rather than each faulting instruction. If the write is OK, the helper will map the target address and do the write. Have a look at, e.g. http://lists.xen.org/archives/html/xen-devel/2012-08/msg01767.html for Julien's multiple-ioreq-handlers code; I'm not sure what the current state of that is, except that it doesn't seem to be checked in yet. Cheers, Tim. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |