khypervisor  v1
Defines | Functions
trap_dabort.c File Reference
#include <arch_types.h>
#include <armv7_p15.h>
#include <vdev.h>
#include <hvmm_trace.h>
#include "context.h"
#include "trap_dabort.h"
#include <log/print.h>
Include dependency graph for trap_dabort.c:

Go to the source code of this file.

Defines

#define DEBUG
#define ISS_VALID   0x01000000
#define ISS_FSR_MASK   0x0000003F
#define ISS_TRANS_FAULT_MASK   0x07
#define TRANS_FAULT_LEVEL1   0x05
#define TRANS_FAULT_LEVEL2   0x06
#define TRANS_FAULT_LEVEL3   0x07
#define ACCESS_FAULT_LEVEL0   0x08
#define ACCESS_FAULT_LEVEL1   0x09
#define ACCESS_FAULT_LEVEL2   0x0A
#define ACCESS_FAULT_LEVEL3   0x0B
#define ISS_WNR_SHIFT   6
#define ISS_WNR   (1 << ISS_WNR_SHIFT)
#define ISS_SAS_SHIFT   22
#define ISS_SAS_MASK   (0x3 << ISS_SAS_SHIFT)
#define ISS_SAS_BYTE   0x0
#define ISS_SAS_HWORD   0x1
#define ISS_SAS_WORD   0x2
#define ISS_SAS_RESERVED   0x3
#define ISS_SSE_SHIFT   21
#define ISS_SSE_MASK   (0x1 << ISS_SSE_SHIFT)
#define ISS_SRT_SHIFT   16
#define ISS_SRT_MASK   (0xf << ISS_SRT_SHIFT)
#define HPFAR_INITVAL   0x00000000
#define HPFAR_FIPA_MASK   0xFFFFFFF0
#define HPFAR_FIPA_SHIFT   4
#define HPFAR_FIPA_PAGE_MASK   0x00000FFF
#define HPFAR_FIPA_PAGE_SHIFT   12

Functions

hvmm_status_t trap_hvc_dabort (unsigned int iss, struct arch_regs *regs)

Define Documentation

#define ACCESS_FAULT_LEVEL0   0x08

Definition at line 41 of file trap_dabort.c.

#define ACCESS_FAULT_LEVEL1   0x09

Definition at line 42 of file trap_dabort.c.

#define ACCESS_FAULT_LEVEL2   0x0A

Definition at line 43 of file trap_dabort.c.

#define ACCESS_FAULT_LEVEL3   0x0B

Definition at line 44 of file trap_dabort.c.

#define DEBUG

Definition at line 8 of file trap_dabort.c.

#define HPFAR_FIPA_MASK   0xFFFFFFF0

Definition at line 64 of file trap_dabort.c.

#define HPFAR_FIPA_PAGE_MASK   0x00000FFF

Definition at line 66 of file trap_dabort.c.

#define HPFAR_FIPA_PAGE_SHIFT   12

Definition at line 67 of file trap_dabort.c.

#define HPFAR_FIPA_SHIFT   4

Definition at line 65 of file trap_dabort.c.

#define HPFAR_INITVAL   0x00000000

Definition at line 63 of file trap_dabort.c.

#define ISS_FSR_MASK   0x0000003F

Definition at line 36 of file trap_dabort.c.

#define ISS_SAS_BYTE   0x0

Definition at line 51 of file trap_dabort.c.

#define ISS_SAS_HWORD   0x1

Definition at line 52 of file trap_dabort.c.

#define ISS_SAS_MASK   (0x3 << ISS_SAS_SHIFT)

Definition at line 50 of file trap_dabort.c.

#define ISS_SAS_RESERVED   0x3

Definition at line 54 of file trap_dabort.c.

#define ISS_SAS_SHIFT   22

Definition at line 49 of file trap_dabort.c.

#define ISS_SAS_WORD   0x2

Definition at line 53 of file trap_dabort.c.

#define ISS_SRT_MASK   (0xf << ISS_SRT_SHIFT)

Definition at line 60 of file trap_dabort.c.

#define ISS_SRT_SHIFT   16

Definition at line 59 of file trap_dabort.c.

#define ISS_SSE_MASK   (0x1 << ISS_SSE_SHIFT)

Definition at line 57 of file trap_dabort.c.

#define ISS_SSE_SHIFT   21

Definition at line 56 of file trap_dabort.c.

#define ISS_TRANS_FAULT_MASK   0x07

Definition at line 37 of file trap_dabort.c.

#define ISS_VALID   0x01000000

Definition at line 34 of file trap_dabort.c.

#define ISS_WNR   (1 << ISS_WNR_SHIFT)

Definition at line 47 of file trap_dabort.c.

#define ISS_WNR_SHIFT   6

Definition at line 46 of file trap_dabort.c.

#define TRANS_FAULT_LEVEL1   0x05

Definition at line 38 of file trap_dabort.c.

#define TRANS_FAULT_LEVEL2   0x06

Definition at line 39 of file trap_dabort.c.

#define TRANS_FAULT_LEVEL3   0x07

Definition at line 40 of file trap_dabort.c.


Function Documentation

hvmm_status_t trap_hvc_dabort ( unsigned int  iss,
struct arch_regs regs 
)

Definition at line 72 of file trap_dabort.c.

{
    hvmm_status_t result = HVMM_STATUS_UNKNOWN_ERROR;
    //far, fipa, il
    uint32_t far = read_hdfar();
    uint32_t fipa;
    uint32_t sas, srt, wnr;

    HVMM_TRACE_ENTER();

    printh( "trap_hvc_dabort: hdfar:%x hpfar:%x\n", far, read_hpfar() );
    fipa = (read_hpfar() & HPFAR_FIPA_MASK) >> HPFAR_FIPA_SHIFT;
    fipa = fipa << HPFAR_FIPA_PAGE_SHIFT;
    fipa = fipa | (far & HPFAR_FIPA_PAGE_MASK);
    sas = (iss & ISS_SAS_MASK) >> ISS_SAS_SHIFT;
    srt = (iss & ISS_SRT_MASK) >> ISS_SRT_SHIFT;
    wnr = (iss & ISS_WNR) ? 1 : 0;

    if ( (iss & ISS_VALID) && ((iss & ISS_FSR_MASK) < 8) ) {
        /*
           vdev emulates read/write, update pc, update destination register
         */
        result = vdev_emulate(fipa, wnr, (vdev_access_size_t) sas, srt, regs );
        if ( result != HVMM_STATUS_SUCCESS ) {
            printh( "trap_dabort: emulation failed guest pc:%x\n", regs->pc );

            /* Let the guest continue by increasing pc */
            regs->pc += 4;
        }
    } else {
        printh( "trap_dboart: fipa=0x%x\n", fipa );
        result = HVMM_STATUS_BAD_ACCESS;
    }
    if ( result != HVMM_STATUS_SUCCESS ) {
        printh( "- INSTR: %s[%d] r%d [%x]\n", wnr ? "str" : "ldr", (sas + 1) * 8, srt, fipa );
    }

    switch (iss & ISS_FSR_MASK) {
        case TRANS_FAULT_LEVEL1:
        case TRANS_FAULT_LEVEL2:
        case TRANS_FAULT_LEVEL3:
            break;

        case ACCESS_FAULT_LEVEL1:
        case ACCESS_FAULT_LEVEL2:
        case ACCESS_FAULT_LEVEL3:
            {
                printh("ACCESS fault %d\n", iss & ISS_FSR_MASK);
            }
            break;
        default:
        break;
    }
    HVMM_TRACE_EXIT();

    return result;
}

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines