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);
18 // Writes data from the IO port (OUT, OUTS)
19 int (*write)(ushort_t port, void * src, uint_t length);
21 struct vmm_io_hook * next;
22 struct vmm_io_hook * prev;
27 typedef struct vmm_io_map {
36 void add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook);
40 vmm_io_hook_t * get_io_hook(vmm_io_map_t * io_map, uint_t port);
44 void hook_io_port(vmm_io_map_t * io_map, uint_t port,
45 int (*read)(ushort_t port, void * dst, uint_t length),
46 int (*write)(ushort_t port, void * src, uint_t length));
48 void init_vmm_io_map(vmm_io_map_t * io_map);
50 void PrintDebugIOMap(vmm_io_map_t * io_map);