Skip to content

Commit e997962

Browse files
committed
更新 axcpu 依赖项的定义,移除分支指定;修复 axvcpu 的使用,简化 MMIO 读写操作
1 parent 312ef08 commit e997962

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ percpu = { version = "0.2.0", features = ["arm-el2"] }
2323

2424
# System dependent modules provided by ArceOS-Hypervisor.
2525
axvcpu = "0.1"
26+
axcpu = { git = "https://github.com/arceos-hypervisor/axcpu", branch = "vmm", features = ["arm-el2"] }
2627
axaddrspace = "0.1"
2728
axdevice = { git = "https://github.com/arceos-hypervisor/axdevice.git" }
2829
axdevice_base = "0.1"
@@ -35,6 +36,6 @@ x86_vcpu = "0.1"
3536
riscv_vcpu = { git = "https://github.com/arceos-hypervisor/riscv_vcpu.git" }
3637

3738
[target.'cfg(target_arch = "aarch64")'.dependencies]
38-
arm_vcpu = { git = "https://github.com/arceos-hypervisor/arm_vcpu.git", branch = "dev-irq" }
39+
arm_vcpu = { path = "/home/zhourui/arceos/arm_vcpu" }
3940
arm_vgic = { git = "https://github.com/arceos-hypervisor/arm_vgic.git", features = ["vgicv3"] }
4041

src/vm.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use spin::Mutex;
1111

1212
use axaddrspace::{AddrSpace, GuestPhysAddr, HostPhysAddr, MappingFlags, device::AccessWidth};
1313
use axdevice::{AxVmDeviceConfig, AxVmDevices};
14-
use axvcpu::{AxArchVCpu, AxVCpu, AxVCpuExitReason, AxVCpuHal};
14+
use axvcpu::{AxVCpu, AxVCpuExitReason, AxVCpuHal};
1515
use cpumask::CpuMask;
1616

1717
use crate::config::{AxVMConfig, VmMemMappingType};
@@ -83,6 +83,7 @@ impl<H: AxVMHal, U: AxVCpuHal> AxVM<H, U> {
8383
.dtb_load_gpa
8484
.unwrap_or_default()
8585
.as_usize(),
86+
entry_guest: axcpu::el2::enter_guest,
8687
};
8788
#[cfg(target_arch = "riscv64")]
8889
let arch_config = AxVCpuCreateConfig {
@@ -295,7 +296,7 @@ impl<H: AxVMHal, U: AxVCpuHal> AxVM<H, U> {
295296
}
296297
#[cfg(not(target_arch = "aarch64"))]
297298
{
298-
<AxArchVCpuImpl<U> as AxArchVCpu>::SetupConfig::default()
299+
<AxArchVCpuImpl<U> as axvcpu::AxArchVCpu>::SetupConfig::default()
299300
}
300301
};
301302

@@ -435,15 +436,13 @@ impl<H: AxVMHal, U: AxVCpuHal> AxVM<H, U> {
435436
reg_width: _,
436437
signed_ext: _,
437438
} => {
438-
let val = self
439-
.get_devices()
440-
.handle_mmio_read(*addr, (*width).into())?;
439+
let val = self.get_devices().handle_mmio_read(*addr, *width)?;
441440
vcpu.set_gpr(*reg, val);
442441
true
443442
}
444443
AxVCpuExitReason::MmioWrite { addr, width, data } => {
445444
self.get_devices()
446-
.handle_mmio_write(*addr, (*width).into(), *data as usize)?;
445+
.handle_mmio_write(*addr, *width, *data as usize)?;
447446
true
448447
}
449448
AxVCpuExitReason::IoRead { port, width } => {
@@ -591,7 +590,7 @@ impl<H: AxVMHal, U: AxVCpuHal> AxVM<H, U> {
591590
)
592591
};
593592
let mut copied_bytes = 0;
594-
for (_i, chunk) in buffer.iter_mut().enumerate() {
593+
for chunk in buffer.iter_mut() {
595594
let end = copied_bytes + chunk.len();
596595
chunk.copy_from_slice(&bytes[copied_bytes..end]);
597596
copied_bytes += chunk.len();

0 commit comments

Comments
 (0)