X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_dev.h;h=3b67c61d65b6c8eee28ef8fa5fd7a81e5f60df26;hb=7841dc573457c334a0f3b6e9186d26b1776c400f;hp=29f8a246ba7a50ddcf3d7bee889c830e9574fcad;hpb=1ca13097c7c85318c400c3811ccbb54ac6c619f1;p=palacios-OLD.git diff --git a/palacios/include/palacios/vmm_dev.h b/palacios/include/palacios/vmm_dev.h index 29f8a24..3b67c61 100644 --- a/palacios/include/palacios/vmm_dev.h +++ b/palacios/include/palacios/vmm_dev.h @@ -1,16 +1,97 @@ #ifndef __VMM_DEV_H #define __VMM_DEV_H +#include + +struct vm_guest; +struct vm_device_io_hook; +struct vm_device_mem_hook; + + +// +// This structure defines an abstract io and/or memory-mapped device +// It currently does not define the interaction with actual hardware +// + struct vm_device { - int (*init_device + int (*init_device)(struct vm_device *dev, struct vm_guest *vm); + int (*deinit_device)(struct vm_device *dev); -}; + int (*reset_device)(struct vm_device *dev); + + int (*start_device)(struct vm_device *dev); + int (*stop_device)(struct vm_device *dev); + + + // + // To understand how to register these callbacks + // see vmm_dev_mgr.h + // + // Note that callbacks like these are only called + // when the port/memory is hooked as EMULATED + // + + + // + // If your device is I/O mapped, this function will + // be called on an I/O read + // + + int (*read_io_port)(ushort_t port_read, + void *address, + uint_t length, + struct vm_device *dev); + + // + // If your device is I/O mapped, this function will + // be called on an I/O write + // + int (*write_io_port)(ushort_t port_written, + void *address, + uint_t length, + struct vm_device *dev); + // + // If your device is memory mapped, this function will + // be called on an memory read + // + + int (*read_mapped_memory)(void *address_read, + void *address, + uint_t length, + struct vm_device *dev); + + // + // If your device is memory mapped, this function will + // be called on an memory read + // + + int (*write_mapped_memory)(void *address_written, + void *address, + uint_t length, + struct vm_device *dev); + + + //int (*save_device)(struct vm_device *dev, struct *iostream); + //int (*restore_device)(struct vm_device *dev, struct *iostream); + + struct guest_info *vm; + + void *private_data; + + // Do not touch anything below this! + + struct vm_device *next, *prev; + + struct vm_device_io_hook *io_hooks; + struct vm_device_mem_hook *mem_hooks; + +}; #endif