在ARM平台上启动2个nimbos,分别实现timer注入 #52
luodeb
started this conversation in
Show and tell
Replies: 3 comments 9 replies
-
多串口QEMU如果不能正常启动,考虑使用修改版的qemu git clone https://github.com/luodeb/qemu.git
./configure --enable-slirp --target-list=aarch64-softmmu,aarch64-linux-user --prefix=/path/to/qemu-9.2.0
make -j
make install
|
Beta Was this translation helpful? Give feedback.
0 replies
-
多平台下的适配同步
(1) crates/axvcpu/src/exit.rs #[non_exhaustive]
#[derive(Debug)]
pub enum AxVcpuFunction {
SetTimer { deadline: u64 },
None,
}
...
pub enum AxVCpuExitReason {
...
VcpuFuncCall(AxVcpuFunction),
... (2) arceos-umhv/arceos-vmm/src/vmm/vcpus.rs AxVCpuExitReason::VcpuFuncCall(func) => match func {
AxVcpuFunction::SetTimer { deadline } => {
let now = axhal::time::monotonic_time_nanos();
register_timer(deadline + now, |_| {
trace!("Timer expired: {}", axhal::time::monotonic_time_nanos());
let gich = axhal::irq::MyVgic::get_gich();
let hcr = gich.get_hcr();
gich.set_hcr(hcr | 1 << 0);
let mut lr = 0;
lr |= 30 << 0;
lr |= 1 << 19;
lr |= 1 << 28;
gich.set_lr(0, lr);
});
}
AxVcpuFunction::None => {}
_ => {
warn!("Unhandled AxVcpuFunction");
}
}, 我看到riscv也需要类似的东西,SbiCall,所以我们其实可以统一一下
let gich = axhal::irq::MyVgic::get_gich();
let hcr = gich.get_hcr();
gich.set_hcr(hcr | 1 << 0);
let mut lr = 0;
lr |= 30 << 0;
lr |= 1 << 19;
lr |= 1 << 28;
gich.set_lr(0, lr); 这一部分非常的hack,需要在axhal中实现类似的方法,
AxVCpuExitReason::SysRegRead { addr, reg } => {
let exit = AxArchEmuRegs::<U>::emu_register_handle_read(
(*addr).into(),
*reg,
vcpu.clone(),
);
break AxVCpuExitReason::VcpuFuncCall(exit);
}
AxVCpuExitReason::SysRegWrite { addr, value } => {
let exit = AxArchEmuRegs::<U>::emu_register_handle_write(
(*addr).into(),
*value,
vcpu.clone(),
);
break AxVCpuExitReason::VcpuFuncCall(exit);
}
fn handle_read(&self, addr: GuestPhysAddr, width: usize, vcpu: &dyn VCpuIf) 定义一个统一的数据结构来传递vcpu_id,vcpu_num等信息,暂时没写,只传了整个vcpu
BOOT_PT_L1[2] = PageTableEntry::new_page(
PhysAddr::new(0x8000_0000),
MemFlags::READ | MemFlags::WRITE | MemFlags::EXECUTE,
true,
); |
Beta Was this translation helpful? Give feedback.
9 replies
-
asd |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Clone代码
新建创建项目的
clone.sh
,然后bash clone.sh
自动创建项目编译nimbos
因为加载到任意地址的功能还没有实现,所以只能通过硬配置来做,得单独编译两个nimbos
nimbos(VM1)
nimbos(VM2)
创建
disk.img
文件生成一个disk.img,然后将编译好的nimbos.bin重命名并放入里面
启动VMM
就可以正常注入timer了
VM1
VM2
Beta Was this translation helpful? Give feedback.
All reactions