This commit is contained in:
Alex Zenla
2024-04-29 04:31:56 -07:00
parent 4839ee2679
commit 8c59be1956
9 changed files with 677 additions and 69 deletions

View File

@ -9,7 +9,7 @@ use log::{debug, trace};
use nix::errno::Errno;
use slice_copy::copy;
use xencall::sys::{
E820Entry, VcpuGuestContext, E820_MAX, E820_RAM, E820_UNUSABLE, MMUEXT_PIN_L4_TABLE,
x8664VcpuGuestContext, E820Entry, VcpuGuestContextAny, E820_MAX, E820_RAM, E820_UNUSABLE, MMUEXT_PIN_L4_TABLE
};
use crate::{
@ -839,7 +839,7 @@ impl BootSetupPlatform for X86PvPlatform {
.ok_or(Error::MemorySetupFailed("start_info_segment missing"))?;
let pg_pfn = page_table_segment.pfn;
let pg_mfn = domain.phys.p2m[pg_pfn as usize];
let mut vcpu = VcpuGuestContext::default();
let mut vcpu = x8664VcpuGuestContext::default();
vcpu.user_regs.rip = domain.image_info.virt_entry;
vcpu.user_regs.rsp =
domain.image_info.virt_base + (boot_stack_segment.pfn + 1) * self.page_size();
@ -861,7 +861,9 @@ impl BootSetupPlatform for X86PvPlatform {
vcpu.kernel_ss = vcpu.user_regs.ss as u64;
vcpu.kernel_sp = vcpu.user_regs.rsp;
trace!("vcpu context: {:?}", vcpu);
domain.call.set_vcpu_context(domain.domid, 0, &vcpu).await?;
domain.call.set_vcpu_context(domain.domid, 0, VcpuGuestContextAny {
value: vcpu,
}).await?;
Ok(())
}