Git Product home page Git Product logo

kvmtest's Introduction

Kvmtest

This sample demonstrates KVM API to manage VMs from FreePascal. This work has been mainly inspired by the article at [1].

Requirements

A Linux host with KVM. Also you need to install freepascal and nasm.

How to build the example

To build the example, you have just to run ./build.sh. You are going to get something like:

IO: port: 0x0010, value: 0x0000
IO: port: 0x0010, value: 0x0001
IO: port: 0x0010, value: 0x0002
IO: port: 0x0010, value: 0x0003
IO: port: 0x0010, value: 0x0004
HLT!
Halt instruction, rax: 0x0005, rbx: 0x0002

This output corresponds with the following assembly code:

start:
  mov rax, 0
loop:
  out $10, ax // this triggers a VMEXIT
  inc ax
  cmp ax, 5
  jne loop
  hlt  // this triggers a VMEXIT

Bibliography

[1] https://lwn.net/Articles/658511/

[2] https://github.com/soulxu/kvmsample

[3] https://github.com/dpw/kvm-hello-world/blob/master/kvm-hello-world.c

[4] https://prog.world/kvm-host-in-a-couple-of-lines-of-code/

[5] https://www.freepascal.org/docs-html/rtl/baseunix/fpioctl.html

[6] https://github.com/torvalds/linux/blob/master/include/uapi/linux/kvm.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.