Skip to main content

The KVM Hypervisor

Introduction

This guide explains how to use the KVM hypervisor through its API directly without using any third party library or software such as libvirt, qemu etc.

A brief explanation of how the KVM system exposes itself is presented below. KVM hypervisor provides 4 types of ioctl or input/output controls. They are a logical hierarchy of what you would expect a hypervisor system to do. First you have system calls, which you can use to create a virtual machine. Once created you will receive a path or file descriptor to that VM which can be used to issue Virtual Machine Calls. After the VM is created, you will similarly receive a file descriptor. You can use this file descriptor as an address to issue both Virtual CPU calls and device calls.

System Calls

These query and set global attributes which affect the whole kvm subsystem. In addition a system ioctl is used to create virtual machines.

Virtual Machine Calls

These query and set attributes that affect an entire virtual machine, for example memory layout. In addition a VM ioctl is used to create virtual cpus (vcpus) and devices.

Virtual CPU Calls

These query and set attributes that control the operation of a single virtual cpu.

Device Calls

These query and set attributes that control the operation of a single device.

 

Comments

Popular posts from this blog

Top Android Encryption Apps

After I released my own android encryption app called Dexacrypt , I wanted to see what else was available on the market. Although, I thought my idea was unique there are already a large number of encryption apps on the market. Let's review some of them and rank them.  In this post, we will only look at message encryption apps and not advanced apps such as Surespot or SSE that provide file encryption or messaging. Meet the Contenders: Encrypt Messages And Text This app was last updated in November 2021 and has more than a 100,000 installs. Many reviews praise its simple UI and small size, however one user has specified that the latest version no longer works on Android 12. Secret Message - Encrypt/Decrypt Messages This app has a slightly larger size of 12 MB but only has 5000+ installs. The top review says and I quote, I am sorry but this is not as easy or self explanatory as it should be. You need to grab someone and hand them a phone and watch their expression. Ouch! maybe h...

Beware: Those who use chatGPT for their exams or work!

ChatGPT struggles with prime numbers! While trying to understand how the public private key cryptographic architecture works using chatGPT, I asked what is a coprime number after chatgpt explained its use in the said architecture. Here is the response in all its glory: Two numbers are said to be coprime (or relatively prime) if they have no common prime factors other than 1. In other words, their greatest common divisor (GCD) is 1. For example: 8 and 15 are coprime because their only common factor is 1. 14 and 15 are coprime because they share no common factors other than 1. 10 and 21 are not coprime because they both have 1 as a common factor. Looking at the first and then the last example which is supposed to be a counter-example as to what is not a coprime number, we can clearly see that chatgpt gives the same reason for each case i.e they only have 1 as a common factor. After further investigation, chatgpt replies: Apologies for the confusion. You're correct. 10 and 21 do not h...

GameDev Lessons: Endless Runners Part 1

Every Game Developer probably starts with an endless runner and there are many tutorials on the internet to do just that but after building a few myself, I can tell you that most of those tutorials are filled with bad advice which from a learning point of view makes sense to help a beginner get the concepts quickly but in the long run they can turn things into a gruesome mess which becomes a chore to update or improve upon. It is my opinion that although a tutorial should have instructions that are quick and easy to replicate, it is much more important to organize the code and assets in such a way that they can be easily built upon. Almost every tutorial at the end of the day should be self contained as much as possible so that they can be easily changed by the person following it. This means, instead of simply uploading a zip file containing the whole project, each part of the tutorial should be organized in such a way so they can be easily copied into an existing project. Now with th...