khypervisor
v1
|
00001 #ifndef __VDEV_H_ 00002 #define __VDEV_H_ 00003 00004 #include <context.h> 00005 #include <hvmm_types.h> 00006 00007 typedef enum { 00008 VDEV_ACCESS_BYTE = 0, 00009 VDEV_ACCESS_HWORD = 1, 00010 VDEV_ACCESS_WORD = 2, 00011 VDEV_ACCESS_RESERVED = 3 00012 } vdev_access_size_t; 00013 00014 /* 00015 * @write 0: read, 1: write 00016 * @offset offset in bytes from base address 00017 * @pvalue address to input value (if write) or output value (if read) 00018 * return: HVMM_STATUS_SUCCESS if successful, failed otherwise 00019 */ 00020 typedef hvmm_status_t (* vdev_callback_t)(uint32_t wnr, uint32_t offset, uint32_t *pvalue, vdev_access_size_t access_size); 00021 00022 typedef struct { 00023 char *name; 00024 unsigned int base; 00025 unsigned int size; 00026 vdev_callback_t handler; 00027 } vdev_info_t; 00028 00029 void vdev_init(void); 00030 int register_vdev(void); 00031 hvmm_status_t vdev_reg_device(vdev_info_t *new_vdev); 00032 hvmm_status_t vdev_emulate(uint32_t fipa, uint32_t wnr, vdev_access_size_t access_size, uint32_t srt, struct arch_regs *regs); 00033 00034 #endif //__VDEV_H_