4 #include <palacios/vmm_types.h>
6 #include <palacios/vmm_util.h>
8 // FOREACH_IO_HOOK(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook)
9 #define FOREACH_IO_HOOK(io_map, io_hook) for (io_hook = (io_map).head; io_hook != NULL; io_hook = (io_hook)->next)
12 typedef struct vmm_io_hook {
15 // Reads data into the IO port (IN, INS)
16 int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data);
18 // Writes data from the IO port (OUT, OUTS)
19 int (*write)(ushort_t port, void * src, uint_t length, void * priv_data);
23 struct vmm_io_hook * next;
24 struct vmm_io_hook * prev;
29 typedef struct vmm_io_map {
38 int add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
40 int remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
42 vmm_io_hook_t * get_io_hook(vmm_io_map_t * io_map, uint_t port);
46 int hook_io_port(vmm_io_map_t * io_map, uint_t port,
47 int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data),
48 int (*write)(ushort_t port, void * src, uint_t length, void * priv_data),
51 int unhook_io_port(vmm_io_map_t * io_map, uint_t port);
53 void init_vmm_io_map(vmm_io_map_t * io_map);
55 void PrintDebugIOMap(vmm_io_map_t * io_map);