-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from novafacing/windows-and-bindings-support
Windows and bindings support
- Loading branch information
Showing
36 changed files
with
1,273 additions
and
579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-----BEGIN OPENSSH PRIVATE KEY----- | ||
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn | ||
NhAAAAAwEAAQAAAYEA2bW01Jm9ujWY0VoDuL3D4XmQ09D1Tkyg98MQoXNg7nZ6IJP2F8PW | ||
N4OHRwrd6/flcDj5c8YfgkwqCryu8f/qq+nlgaQ8dskJIUnaLa3YtVax2K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b3hAAAAwQDg9fyPweE++XeHXtyzqDZIRRw5O/fsEGow | ||
cgSDfII2zJhiPOzO55HuguS92uak7oLsoFx5+Ulw9jdFu+spn2W2+iAaSlg9CTQVSt/Z/W | ||
gyN48rYziYtoC0eKcKNdXoMX+ovAdwRA7LfGVc3MKm1jX+tlJ6lcWT5ZAodGdDX+mzMJfA | ||
8U6K4Z/lgId5D/xZjNMm5n+dZ7rnLcQoUsa7nnrJ6wob4nDDEYDIGx4FvDIyyEupRmesmt | ||
2S9f5i0kz7hNEAAAAQZmVkb3JhQGxvY2FsaG9zdAECAw== | ||
-----END OPENSSH PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDZtbTUmb26NZjRWgO4vcPheZDT0PVOTKD3wxChc2Dudnogk/YXw9Y3g4dHCt3r9+VwOPlzxh+CTCoKvK7x/+qr6eWBpDx2yQkhSdotrdi1VrHYqtC7/bMcfpK0hpuJBgoz7ovQ49nHCttf65J+z9AQAXQoLFxdUOO9eOm86Vr4xa6eb0H6zXXKP6p6xJz4xamBkq9lgfwWYgjL4/vtyeeMOBfHnW8cd07ysji4u6g2loxCOpu2kY/ekVhuoAh3WWtBIHNUnjJuuFnD/6l/OGhescMJ3iVN3p+KGPQgdCQ+a7GB3T0Rk41+yIMZfuJShOtG8a31aMJUKXO+M+AIjL/SGlQbj/7UYC1fhXes3ziBPV76pOEUvwaKaI/NRcvVptPlhCJYJs394n3SR39ON+GwCEPXE44rxOUeL/bwI4X5zOFJ6S2dybRaueDnBZilmQkbvJfgYTkwpaKSAJcHhK8JbzXT4h6+CTWDucvZzyjKdiLEbYl8TireBwWY5/1TCLE= fedora@localhost |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,6 @@ Cargo.lock | |
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
.env | ||
.secrets | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV PATH="${PATH}:/root/.cargo/bin" | ||
|
||
RUN apt-get -y update && \ | ||
apt-get -y install bison flex git curl libglib2.0-dev libfdt-dev \ | ||
libpixman-1-dev zlib1g-dev ninja-build build-essential python3 python3-pip python3-venv && \ | ||
python3 -m pip install sphinx sphinx_rtd_theme && \ | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly | ||
|
||
COPY . /qemu-rs | ||
|
||
WORKDIR /qemu-rs | ||
|
||
RUN cargo build -r && \ | ||
cargo run -r --bin tracer -- -a /bin/ls -- -lah | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "tiny-system" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
qemu-plugin.workspace = true | ||
anyhow = "1.0.75" | ||
ffi = "0.1.0" | ||
ctor = "0.2.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use anyhow::{anyhow, Result}; | ||
use ctor::ctor; | ||
use qemu_plugin::{ | ||
plugin::{HasCallbacks, Plugin, Register, PLUGIN}, | ||
PluginId, | ||
}; | ||
use std::sync::Mutex; | ||
|
||
struct TinyTrace {} | ||
|
||
impl Plugin for TinyTrace {} | ||
impl Register for TinyTrace {} | ||
|
||
impl HasCallbacks for TinyTrace { | ||
fn on_vcpu_init( | ||
&mut self, | ||
id: PluginId, | ||
vcpu_id: qemu_plugin::VCPUIndex, | ||
) -> std::prelude::v1::Result<(), anyhow::Error> { | ||
println!("on_vcpu_init: id: {:?}, vcpu_id: {:?}", id, vcpu_id); | ||
Ok(()) | ||
} | ||
|
||
fn on_vcpu_idle( | ||
&mut self, | ||
id: PluginId, | ||
vcpu_id: qemu_plugin::VCPUIndex, | ||
) -> std::prelude::v1::Result<(), anyhow::Error> { | ||
println!("on_vcpu_idle: id: {:?}, vcpu_id: {:?}", id, vcpu_id); | ||
Ok(()) | ||
} | ||
|
||
fn on_vcpu_exit( | ||
&mut self, | ||
id: PluginId, | ||
vcpu_id: qemu_plugin::VCPUIndex, | ||
) -> std::prelude::v1::Result<(), anyhow::Error> { | ||
println!("on_vcpu_exit: id: {:?}, vcpu_id: {:?}", id, vcpu_id); | ||
Ok(()) | ||
} | ||
|
||
fn on_vcpu_resume( | ||
&mut self, | ||
id: PluginId, | ||
vcpu_id: qemu_plugin::VCPUIndex, | ||
) -> std::prelude::v1::Result<(), anyhow::Error> { | ||
println!("on_vcpu_resume: id: {:?}, vcpu_id: {:?}", id, vcpu_id); | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[ctor] | ||
fn init() { | ||
PLUGIN | ||
.set(Mutex::new(Box::new(TinyTrace {}))) | ||
.map_err(|_| anyhow!("Failed to set plugin")) | ||
.expect("Failed to set plugin"); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
[package] | ||
name = "tracer" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
name = "tracer" | ||
crate-type = ["cdylib", "lib"] | ||
|
||
[dependencies] | ||
anyhow = "1.0.75" | ||
ctor = "0.2.6" | ||
qemu-plugin = { workspace = true, features = ["unix-weak-link"] } | ||
serde = { version = "1.0.193", features = ["derive"] } | ||
serde_cbor = "0.11.2" | ||
tokio = { version = "1.35.0", features = ["full"] } | ||
typed-builder = "0.18.0" | ||
yaxpeax-x86 = "1.2.2" | ||
|
||
# Dependencies only used by this crate's `tracer` binary. We do not use dev-dependencies | ||
# because they cannot be optional. | ||
clap = { version = "4.4.11", features = ["derive", "string"] } | ||
# Enable the `qemu` feature to build and install QEMU with the `qemu` crate instead | ||
# of trying to use the system QEMU. | ||
qemu = { workspace = true, features = [ | ||
"plugins", | ||
"debug-info", | ||
], optional = true } | ||
memfd-exec = { version = "0.2.1", optional = true } | ||
rand = "0.8.5" | ||
serde_json = "1.0.108" | ||
|
||
[features] | ||
qemu = ["dep:memfd-exec", "dep:qemu"] | ||
default = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.