Skip to content

Intel's VT-x / VT-d APIs for the Bareflank hypervisor

License

Notifications You must be signed in to change notification settings

ycscaly/extended_apis

 
 

Repository files navigation

Extended APIs


GitHub version Build Status codecov CII Best Practices Join the chat at https://gitter.im/Bareflank-hypervisor/Lobby

Description

The Bareflank Hypervisor's main goal is to provide the "bare" minimum hypervisor. Since Bareflank supports C++ 11/14, multiple operating systems, and a full toolstack, it's not as simple as say SimpleVisor, but still adheres to the same basic principles of leaving out the complexity of a full blown hypervisor in favor of an implementation that is simple to read and follow.

It is our goal to provide a hypervisor that others can extend to create their own hypervisors. To this end, it is likely that when creating your own hypervisor, some tasks will be redundant. For example, Windows makes a lot of MSR accesses. When running Bareflank this is obvious as Windows takes a significant performance penalty since all MSR accesses are emulated. The first step most people will take on an Intel platform is to enable VPID and MSR bitmaps to increase performance. The process of setting up these resources is the same, regardless of what type of hypervisor you might be creating.

The purpose of this repository, is to provide an extended set of APIs to build your hypervisors from. Some of these APIs include:

  • MSR / IO Bitmaps
  • VPID / Extended Page Tables (EPT)
  • Monitor Traps
  • Virtual APIC / Interrupt Management
  • ACPI / Timers

Compilation / Usage

To setup the extended_apis, we must clone the extension into the Bareflank root folder and run make (the following assumes this is running on Linux).

cd ~/
git clone https://github.com/Bareflank/hypervisor.git
cd ~/hypervisor
git clone https://github.com/Bareflank/extended_apis.git

./tools/scripts/setup-<xxx>.sh --no-configure
sudo reboot

cd ~/hypervisor
./configure -m ./extended_apis/bin/extended_apis.modules

make
make test

To test out the extended version of Bareflank, all we need to do is run the make shortcuts as usual:

make driver_load
make quick

make status
make dump

make stop
make driver_unload

There are also a number of tests that can be run that demonstrate the various different vmcalls that are provided. For example:

cd ~/hypervisor
./extended_apis/tests/test_vpid.sh

The test_vpid.sh enables / disables VPID using JSON based vmcalls on all of the cores as follows

run_on_all_cores() {
    for (( core=0; core<$NUM_CORES; core++ ))
    do
        ARGS="--cpuid $core string json $1" make vmcall > /dev/null
    done
}

run_on_all_cores "'{\"command\":\"enable_vpid\", \"enabled\": false}'"
run_on_all_cores "'{\"command\":\"enable_vpid\", \"enabled\": true}'"

Links

Bareflank Hypervisor Website
Bareflank Hypervisor API Documentation

Roadmap

The project roadmap can be located here

License

The Bareflank Hypervisor is licensed under the GNU Lesser General Public License v2.1 (LGPL).

About

Intel's VT-x / VT-d APIs for the Bareflank hypervisor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 85.7%
  • HyPhy 8.0%
  • Shell 4.3%
  • C 2.0%