X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_io.h;h=b1e211c05495b297b4390ac3dd0d6b76e29b8141;hb=75d9c52b3ee8673c9f358b7815d2026da5319ca7;hp=34c04f05078d8213225ec415495e9621853ccf16;hpb=570ad6257ed18fbbc840c17a600f12f2dc44b010;p=palacios.git diff --git a/palacios/include/palacios/vmm_io.h b/palacios/include/palacios/vmm_io.h index 34c04f0..b1e211c 100644 --- a/palacios/include/palacios/vmm_io.h +++ b/palacios/include/palacios/vmm_io.h @@ -1,59 +1,71 @@ +/* (c) 2008, Jack Lange */ +/* (c) 2008, The V3VEE Project */ + #ifndef __VMM_IO_H #define __VMM_IO_H -#include + +#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) +struct guest_info; -typedef struct vmm_io_hook { - ushort_t port; +int v3_unhook_io_port(struct guest_info * info, uint_t port); - // Reads data into the IO port (IN, INS) - int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data); - // Writes data from the IO port (OUT, OUTS) - int (*write)(ushort_t port, void * src, uint_t length, void * priv_data); +/* External API */ +int v3_hook_io_port(struct guest_info * info, uint_t port, + int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data), + int (*write)(ushort_t port, void * src, uint_t length, void * priv_data), + void * priv_data); + - void * priv_data; - struct vmm_io_hook * next; - struct vmm_io_hook * prev; -} vmm_io_hook_t; +#ifdef __V3VEE__ -typedef struct vmm_io_map { +struct vmm_io_hook; + +struct vmm_io_map { uint_t num_ports; + struct vmm_io_hook * head; + +}; + + +void init_vmm_io_map(struct guest_info * info); +// 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) - vmm_io_hook_t * head; -} vmm_io_map_t; +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, void * priv_data); + // Writes data from the IO port (OUT, OUTS) + int (*write)(ushort_t port, void * src, uint_t length, void * priv_data); -int add_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook); + void * priv_data; -int remove_io_hook(vmm_io_map_t * io_map, vmm_io_hook_t * io_hook); + struct vmm_io_hook * next; + struct vmm_io_hook * prev; -vmm_io_hook_t * get_io_hook(vmm_io_map_t * io_map, uint_t port); +}; -/* External API */ -int hook_io_port(vmm_io_map_t * io_map, uint_t port, - int (*read)(ushort_t port, void * dst, uint_t length, void * priv_data), - int (*write)(ushort_t port, void * src, uint_t length, void * priv_data), - void * priv_data); +struct vmm_io_hook * v3_get_io_hook(struct vmm_io_map * io_map, uint_t port); -int unhook_io_port(vmm_io_map_t * io_map, uint_t port); -void init_vmm_io_map(vmm_io_map_t * io_map); +void PrintDebugIOMap(struct vmm_io_map * io_map); -void PrintDebugIOMap(vmm_io_map_t * io_map); +#endif // !__V3VEE__