Skip to content

Commit 0d73ec1

Browse files
aarkegzhky1999
andauthored
Interrupt-injection and basic virtual local APIC emulation (timer only) (#19)
* add `inject_interrupt` method * adopted to newest `axvcpu` * [refactor] introduce AxMmHal * add some traces * add more traces * add more traces * try injecting int with vmlaunch * fix format * add external interrupt support * add incomplete vlapic support and general registers diff tracking * update dependency * adding `vm_id` and `vcpu_id` when creating vcpu. * formatted * fix ci errors * formatted --------- Co-authored-by: hky1999 <976929993@qq.com>
1 parent 2cc4234 commit 0d73ec1

File tree

12 files changed

+764
-334
lines changed

12 files changed

+764
-334
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ log = "0.4.19"
88
cfg-if = "1.0"
99
bitflags = "2.2"
1010
bit_field = "0.10"
11+
paste = "1.0.15"
1112
x86 = "0.52"
1213
x86_64 = "0.15"
1314
raw-cpuid = "11.0"
@@ -20,8 +21,12 @@ crate_interface = "0.1"
2021

2122
axaddrspace = { git = "https://github.com/arceos-hypervisor/axaddrspace.git" }
2223
axvcpu = { git = "https://github.com/arceos-hypervisor/axvcpu.git" }
24+
x86_vlapic = { git = "https://github.com/arceos-hypervisor/x86_vlapic.git" }
25+
axdevice_base = { git = "https://github.com/arceos-hypervisor/axdevice_crates.git" }
26+
axvisor_api = { git = "https://github.com/arceos-hypervisor/axvisor_api.git" }
2327

2428
[features]
2529
default = ["vmx"]
30+
tracing = []
2631
vmx = []
2732
amd = []

README.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,5 @@
44

55
Definition of the vCPU structure and virtualization-related interface support for x86_64 architecture.
66

7-
The crate user must implement the `PhysFrameIf` trait using
8-
[`crate_interface::impl_interface`](https://crates.io/crates/crate_interface) to provide the low-level implementantion
9-
of the allocation and dealloction of `PhysFrame`, relevant implementation can refer to [ArceOS](https://github.com/arceos-org/arceos/blob/main/modules/axhal/src/paging.rs).
10-
11-
## Example
12-
13-
```Rust
14-
use x86_vcpu::PhysFrameIf;
15-
16-
struct PhysFrameIfImpl;
17-
18-
#[crate_interface::impl_interface]
19-
impl axvm::PhysFrameIf for PhysFrameIfImpl {
20-
fn alloc_frame() -> Option<PhysAddr> {
21-
// Your implementation here
22-
}
23-
fn dealloc_frame(paddr: PhysAddr) {
24-
// Your implementation here
25-
}
26-
fn phys_to_virt(paddr: PhysAddr) -> VirtAddr {
27-
// Your implementation here
28-
}
29-
}
30-
```
7+
The crate user must implement the `AxVCpuHal` trait to provide the required low-level implementantion,
8+
relevant implementation can refer to [axvcpu](https://github.com/arceos-hypervisor/axvcpu/blob/main/src/hal.rs).

src/frame.rs

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub(crate) mod msr;
1313
#[macro_use]
1414
pub(crate) mod regs;
1515
mod ept;
16-
mod frame;
1716

1817
cfg_if::cfg_if! {
1918
if #[cfg(feature = "vmx")] {

src/regs.rs

Lines changed: 0 additions & 196 deletions
This file was deleted.

0 commit comments

Comments
 (0)