khypervisor  v1
Functions
vmm.h File Reference
#include <hvmm_types.h>
#include "lpae.h"
Include dependency graph for vmm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

lpaed_tvmm_vmid_ttbl (vmid_t vmid)
hvmm_status_t vmm_set_vmid_ttbl (vmid_t vmid, lpaed_t *ttbl)
void vmm_stage2_enable (int enable)
void vmm_init (void)

Function Documentation

void vmm_init ( void  )

Definition at line 339 of file vmm.c.

{
    /*
     * Initializes Translation Table for Stage2 Translation (IPA -> PA)
     */
    int i;

    HVMM_TRACE_ENTER();
    for( i = 0; i < NUM_GUESTS_STATIC; i++ ) {
        _vmid_ttbl[i] = 0;
    }

    _vmid_ttbl[0] = &_ttbl_guest0[0];
    _vmid_ttbl[1] = &_ttbl_guest1[0];


    /*
     * VA: 0x00000000 ~ 0x3FFFFFFF,   1GB
     * PA: 0xA0000000 ~ 0xDFFFFFFF    guest_bin_start
     * PA: 0xB0000000 ~ 0xEFFFFFFF    guest2_bin_start
     */

    guest_memory_md0[0].pa = (uint64_t) ((uint32_t) &guest_bin_start);
    guest_memory_md1[0].pa = (uint64_t) ((uint32_t) &guest2_bin_start);

    vmm_init_ttbl(&_ttbl_guest0[0], &guest_mdlist0[0]);
    vmm_init_ttbl(&_ttbl_guest1[0], &guest_mdlist1[0]);
   
    vmm_init_mmu();

    HVMM_TRACE_EXIT();
}

Here is the call graph for this function:

Definition at line 397 of file vmm.c.

{
    uint64_t vttbr;

    /* 
     * VTTBR.VMID = vmid
     * VTTBR.BADDR = ttbl
     */
    vttbr = read_vttbr();
#if 0 /* ignore message due to flood log message */
    uart_print( "current vttbr:" ); uart_print_hex64(vttbr); uart_print("\n\r");
#endif
    vttbr &= ~(VTTBR_VMID_MASK);
    vttbr |= ((uint64_t)vmid << VTTBR_VMID_SHIFT) & VTTBR_VMID_MASK;

    vttbr &= ~(VTTBR_BADDR_MASK);
    vttbr |= (uint32_t) ttbl & VTTBR_BADDR_MASK;
    write_vttbr(vttbr);

    vttbr = read_vttbr();
#if 0 /* ignore message due to flood log message */
    uart_print( "changed vttbr:" ); uart_print_hex64(vttbr); uart_print("\n\r");
#endif
    return HVMM_STATUS_SUCCESS;
}
void vmm_stage2_enable ( int  enable)

Definition at line 383 of file vmm.c.

{
    uint32_t hcr;

    // HCR.VM[0] = enable
    hcr = read_hcr(); //uart_print( "hcr:"); uart_print_hex32(hcr); uart_print("\n\r");
    if ( enable ) {
        hcr |= (0x1);
    } else {
        hcr &= ~(0x1);
    }
    write_hcr( hcr );
}

Definition at line 373 of file vmm.c.

{
    lpaed_t *ttbl = 0;
    if ( vmid < NUM_GUESTS_STATIC ) {
        ttbl = _vmid_ttbl[vmid];
    }
    return ttbl;
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines