aboutsummaryrefslogblamecommitdiffhomepage
path: root/content/2023-01-15-xpost-mini-kvm-rs.md
blob: 709050d28b588f8053e184f468e3de341e85c4f6 (plain) (tree)


















































                                                                                                        
+++
title = "xpost: KVM studies in rust (mini-kvm-rs)"

[taxonomies]
tags = ["kvm", "linux", "x86"]
+++

This is a cross post to a **KVM playground** in rust that I created in the past
and hosted on github [>> mini-kvm-rs <<][mini-kvm].

The [README][mini-kvm-readme] in the root of the repository gives an overview
over the project organization. Additionally, it shows instructions for how to
run two examples provided in the project, a guest running in [16 bit real
mode][mini-kvm-16bit] and a guest running in [64 bit long
mode][mini-kvm-64bit].

The rustdoc is [here][mini-kvm-doc].

## Example: 16 bit real mode

The following shows the 16 bit guest code example.

```nasm
{{ fetch_url(url="https://raw.githubusercontent.com/johannst/mini-kvm-rs/main/guest/guest16.S") }}
```

The following creates a VM and runs the 16 bit example guest image.

```rust
{{ fetch_url(url="https://raw.githubusercontent.com/johannst/mini-kvm-rs/main/examples/real_mode.rs") }}
```

## Example: 64 bit long mode

The following shows the 64 bit guest code example.

```nasm
{{ fetch_url(url="https://raw.githubusercontent.com/johannst/mini-kvm-rs/main/guest/guest64.S") }}
```

The following creates a VM and runs the 64 bit example guest image.

```rust
{{ fetch_url(url="https://raw.githubusercontent.com/johannst/mini-kvm-rs/main/examples/long_mode.rs") }}
```

[mini-kvm]: https://github.com/johannst/mini-kvm-rs
[mini-kvm-readme]: https://github.com/johannst/mini-kvm-rs/blob/main/README.md
[mini-kvm-doc]: https://johannst.github.io/mini-kvm-rs/kvm_rs/index.html
[mini-kvm-16bit]: https://github.com/johannst/mini-kvm-rs#real-mode-16bit-example
[mini-kvm-64bit]: https://github.com/johannst/mini-kvm-rs#long-mode-64bit-example