mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-27 23:23:09 +00:00
arch: Check RSDP address does not go past memory
The setup_mptables() call which is not used on ACPI builds has a side effect of testing whether there was enough RAM which one of the unit tests was relying on. Add a similar check for the RSDP address. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
1c44e917f9
commit
bb8d19bbd6
@ -45,6 +45,8 @@ pub enum Error {
|
|||||||
InitramfsAddress,
|
InitramfsAddress,
|
||||||
/// Error writing module entry to guest memory.
|
/// Error writing module entry to guest memory.
|
||||||
ModlistSetup(vm_memory::GuestMemoryError),
|
ModlistSetup(vm_memory::GuestMemoryError),
|
||||||
|
/// RSDP Beyond Guest Memory
|
||||||
|
RSDPPastRamEnd,
|
||||||
}
|
}
|
||||||
pub type Result<T> = result::Result<T, Error>;
|
pub type Result<T> = result::Result<T, Error>;
|
||||||
|
|
||||||
|
@ -169,6 +169,13 @@ pub fn configure_system(
|
|||||||
// Note that this puts the mptable at the last 1k of Linux's 640k base RAM
|
// Note that this puts the mptable at the last 1k of Linux's 640k base RAM
|
||||||
mptable::setup_mptable(guest_mem, num_cpus).map_err(Error::MpTableSetup)?;
|
mptable::setup_mptable(guest_mem, num_cpus).map_err(Error::MpTableSetup)?;
|
||||||
|
|
||||||
|
// Check that the RAM is not smaller than the RSDP start address
|
||||||
|
if let Some(rsdp_addr) = rsdp_addr {
|
||||||
|
if rsdp_addr.0 > guest_mem.last_addr().0 {
|
||||||
|
return Err(super::Error::RSDPPastRamEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match boot_prot {
|
match boot_prot {
|
||||||
BootProtocol::PvhBoot => {
|
BootProtocol::PvhBoot => {
|
||||||
configure_pvh(guest_mem, cmdline_addr, initramfs, rsdp_addr)?;
|
configure_pvh(guest_mem, cmdline_addr, initramfs, rsdp_addr)?;
|
||||||
@ -481,7 +488,7 @@ mod tests {
|
|||||||
&None,
|
&None,
|
||||||
1,
|
1,
|
||||||
None,
|
None,
|
||||||
None,
|
Some(layout::RSDP_POINTER),
|
||||||
BootProtocol::LinuxBoot,
|
BootProtocol::LinuxBoot,
|
||||||
);
|
);
|
||||||
assert!(config_err.is_err());
|
assert!(config_err.is_err());
|
||||||
|
Loading…
Reference in New Issue
Block a user