#include <context.h>
#include <hvmm_types.h>
Go to the source code of this file.
Data Structures |
struct | vdev_info_t |
Typedefs |
typedef hvmm_status_t(* | vdev_callback_t )(uint32_t wnr, uint32_t offset, uint32_t *pvalue, vdev_access_size_t access_size) |
Enumerations |
enum | vdev_access_size_t { VDEV_ACCESS_BYTE = 0,
VDEV_ACCESS_HWORD = 1,
VDEV_ACCESS_WORD = 2,
VDEV_ACCESS_RESERVED = 3
} |
Functions |
void | vdev_init (void) |
int | register_vdev (void) |
hvmm_status_t | vdev_reg_device (vdev_info_t *new_vdev) |
hvmm_status_t | vdev_emulate (uint32_t fipa, uint32_t wnr, vdev_access_size_t access_size, uint32_t srt, struct arch_regs *regs) |
Typedef Documentation
Enumeration Type Documentation
- Enumerator:
VDEV_ACCESS_BYTE |
|
VDEV_ACCESS_HWORD |
|
VDEV_ACCESS_WORD |
|
VDEV_ACCESS_RESERVED |
|
Definition at line 7 of file vdev.h.
Function Documentation
Definition at line 49 of file vdev.c.
{
hvmm_status_t result = HVMM_STATUS_NOT_FOUND;
int i = 0;
uint32_t offset;
uint8_t isize = 4;
HVMM_TRACE_ENTER();
if ( regs->cpsr & 0x20 ) {
isize = 2;
}
for (i = 0; i < MAX_VDEV; i++){
if ( vdev_list[i].base == 0 ) break;
offset = fipa - vdev_list[i].base;
if ( fipa >= vdev_list[i].base && offset < vdev_list[i].size && vdev_list[i].handler != 0) {
printh("vdev: found %s for fipa %x srt:%x gpr[srt]:%x write:%d vmid:%d\n", vdev_list[i].name, fipa, srt, regs->gpr[srt], wnr, context_current_vmid() );
result = vdev_list[i].handler(wnr, offset, &(regs->gpr[srt]), access_size);
if ( wnr == 0 ) {
printh("vdev: result:%x\n", regs->gpr[srt] );
}
regs->pc += isize;
break;
} else {
printh("vdev: fipa %x base %x not matched\n", fipa, vdev_list[i].base );
}
}
HVMM_TRACE_EXIT();
return result;
}