X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_io.h;fp=palacios%2Finclude%2Fpalacios%2Fvmm_io.h;h=f13eee8b98b777ab7f21ad48893ef2f6fa1677d7;hb=a109eb919a162bd7de58d62020801bc2e633be50;hp=0000000000000000000000000000000000000000;hpb=5ad0c835a5bd7181a7a342478bd398ad73712306;p=palacios.releases.git diff --git a/palacios/include/palacios/vmm_io.h b/palacios/include/palacios/vmm_io.h new file mode 100644 index 0000000..f13eee8 --- /dev/null +++ b/palacios/include/palacios/vmm_io.h @@ -0,0 +1,53 @@ +#ifndef __VMM_IO_H +#define __VMM_IO_H + +#include + +#include + +// FOREACH_IO_HOOK(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook) +#define FOREACH_IO_HOOK(io_map, io_hook) for (io_hook = (io_map).head; io_hook != NULL; io_hook = (io_hook)->next) + + +typedef struct vmm_io_hook { + ushort_t port; + + // Reads data into the IO port (IN, INS) + int (*read)(ushort_t port, void * dst, uint_t length); + + // Writes data from the IO port (OUT, OUTS) + int (*write)(ushort_t port, void * src, uint_t length); + + struct vmm_io_hook * next; + struct vmm_io_hook * prev; + +} vmm_io_hook_t; + + +typedef struct vmm_io_map { + uint_t num_ports; + + + vmm_io_hook_t * head; + +} vmm_io_map_t; + + +void add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook); + + + +vmm_io_hook_t * get_io_hook(vmm_io_map_t * io_map, uint_t port); + + +/* External API */ +void hook_io_port(vmm_io_map_t * io_map, uint_t port, + int (*read)(ushort_t port, void * dst, uint_t length), + int (*write)(ushort_t port, void * src, uint_t length)); + +void init_vmm_io_map(vmm_io_map_t * io_map); + +void PrintDebugIOMap(vmm_io_map_t * io_map); + + +#endif