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

Re: [Xen-users] Running callbacks on instruction fetches and data accesses



On Fri, Dec 09, 2016 at 08:28:35AM +0000, David Vernet wrote:
> Hello Xen users,
> 
> I am interested in using Xen for a research project of mine, and I was
> curious if it was possible to, for an OS running on Xen, run a callback on
> instruction fetches and data accesses. In the context of Simics (an x86
> emulator), this can be accomplished by creating a module with Simics as
> such:
> 
> ```
> /* Initialize our Simics module. */
> void init_local(void)
> {
> const class_data_t funcs = {
> .new_instance = ls_new_instance,
> .class_desc = "desc",
> .description = "A simics module."
> };
> 
> /* Register the empty device class. */
> conf_class_t *conf_class = SIM_register_class(SIM_MODULE_NAME, &funcs);
> 
> /* Register our class class as a trace consumer. */
> static const trace_consume_interface_t trace_int = {
> .consume = (void (*)(conf_object_t *, trace_entry_t *))my_tool_entrypoint
> };
> SIM_register_interface(conf_class, TRACE_CONSUME_INTERFACE, &trace_int);
> }
> ```
> 
> By doing this, Simics will call `my_tool_entrypoint` on every instruction
> and every data access; allowing me to instrument the kernel I'm running as
> I see fit. Is such a feature available for a guest OS running on Xen? We
> can modify the OS to hook into Xen however we need. I am aware that this
> would result in a gigantic performance hit, but that is acceptable for my
> use case.

There's certainly something similar to this, which is called memory
introspection IIRC, but I'm not sure if you can do this against yourself, or if
needs to be performed against a different domain. Anyway, you can find more
information about it in the public/vm_event.h header file.

Roger.


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxx
https://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.