Recent

Author Topic: Running code in the context of a VM by using KVM API from Freepascal  (Read 1137 times)

z0rr0

  • New Member
  • *
  • Posts: 43
Hello everyone,

for those that are interesting in creating Virtual Machines by using the KVM API, I just committed a simple example at https://github.com/MatiasVara/kvmtest. This repository includes the unit "Kvm.pas" that allows a program to run a piece of assembly code, i.e., guest.s, in the context of a VM. The user program ("main.pas" in the repository) acts as a Virtual Machine Monitor(VMM) that traps VMEXIT.

Cheers,
Matias

MarkMLl

  • Hero Member
  • *****
  • Posts: 2876
That looks interesting, but could you expand a bit on what the objective is and what's actually being run? Also you appear to be building for Linux and (obviously) assuming the availability of KVM, but are there any other OS etc. requirements?

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

z0rr0

  • New Member
  • *
  • Posts: 43
Hello MarkMLI,
That looks interesting, but could you expand a bit on what the objective is and what's actually being run? Also you appear to be building for Linux and (obviously) assuming the availability of KVM, but are there any other OS etc. requirements?

MarkMLl

This demo is based on the article https://lwn.net/Articles/658511/. The goal of this simple demo is to show the use of KVM to run a piece of assembly code in the context of a Virtual Machine. To do this, a user program first loads the binary and then interacts with KVM to create a VM that will execute that binary. The binary executes as a KVM guest in 64 bits but without any device. The user program acts as QEMU does, i.e., a virtual machine monitor. Some operations that the guest does are trapped by the user program that hosts it. For example, this happens when the guest tries to access to an ioport. I will add this information to the README.md to make it clear.

Matias     

 

TinyPortal © 2005-2018