Skip to content

Commit

Permalink
dm: Add initial device model
Browse files Browse the repository at this point in the history
The device model is a user mode program which manages VM's life cycles
and handles various vmexits events. The initial version just calls exit()
syscall without doing anything else.

Signed-off-by: Vijay Dhanraj <[email protected]>
Signed-off-by: Chuanxiao Dong <[email protected]>
  • Loading branch information
vijaydhanraj committed Dec 16, 2024
1 parent ff38775 commit 23f2136
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ members = [
"user/lib",
# Init user-space module
"user/init",
# device model module
"user/dm",
]


Expand All @@ -39,6 +41,7 @@ syscall = { path = "syscall" }
packit = { path = "packit" }
userlib = { path = "user/lib" }
userinit = { path = "user/init" }
userdm = { path = "user/dm" }

# crates.io
aes-gcm = { version = "0.10.3", default-features = false }
Expand Down
3 changes: 3 additions & 0 deletions configs/all-targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"modules": {
"userinit": {
"path": "/init"
},
"userdm": {
"path": "/dm"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions configs/hyperv-target.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"modules": {
"userinit": {
"path": "/init"
},
"userdm": {
"path": "/dm"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions configs/qemu-target.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"modules": {
"userinit": {
"path": "/init"
},
"userdm": {
"path": "/dm"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions configs/vanadium-target.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"modules": {
"userinit": {
"path": "/init"
},
"userdm": {
"path": "/dm"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions user/dm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "userdm"
version = "0.1.0"
edition = "2021"

[dependencies]
userlib.workspace = true

[lints]
workspace = true
4 changes: 4 additions & 0 deletions user/dm/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fn main() {
println!("cargo:rustc-link-arg=-Tuser/lib/module.lds");
println!("cargo:rustc-link-arg=-no-pie");
}
16 changes: 16 additions & 0 deletions user/dm/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2024 Intel Corporation.
//
// Author: Vijay Dhanraj <[email protected]>

#![no_std]
#![no_main]

use userlib::*;

declare_main!(main);

fn main() -> u32 {
0
}

0 comments on commit 23f2136

Please sign in to comment.