@@ -35,7 +35,7 @@ use linux_loader::loader::elf::start_info::{
3535
3636use crate :: arch:: { BootProtocol , InitrdConfig , SYSTEM_MEM_SIZE , SYSTEM_MEM_START } ;
3737use crate :: device_manager:: resources:: ResourceAllocator ;
38- use crate :: utils:: u64_to_usize;
38+ use crate :: utils:: { KIB_TO_BYTES_SHIFT , u64_to_usize} ;
3939use crate :: vstate:: memory:: {
4040 Address , GuestAddress , GuestMemory , GuestMemoryMmap , GuestMemoryRegion ,
4141} ;
@@ -70,7 +70,7 @@ pub enum ConfigurationError {
7070const FIRST_ADDR_PAST_32BITS : u64 = 1 << 32 ;
7171
7272/// Size of MMIO gap at top of 32-bit address space.
73- pub const MEM_32BIT_GAP_SIZE : u64 = 768 << 20 ;
73+ pub const MEM_32BIT_GAP_SIZE : u64 = 768 << KIB_TO_BYTES_SHIFT ;
7474/// The start of the memory area reserved for MMIO devices.
7575pub const MMIO_MEM_START : u64 = FIRST_ADDR_PAST_32BITS - MEM_32BIT_GAP_SIZE ;
7676/// The size of the memory area reserved for MMIO devices.
@@ -359,6 +359,7 @@ mod tests {
359359
360360 use super :: * ;
361361 use crate :: test_utils:: { arch_mem, single_region_mem} ;
362+ use crate :: utils:: KIB_TO_BYTES_SHIFT ;
362363
363364 #[ test]
364365 fn regions_lt_4gb ( ) {
@@ -396,7 +397,7 @@ mod tests {
396397 ) ;
397398
398399 // Now assigning some memory that falls before the 32bit memory hole.
399- let mem_size = 128 << 20 ;
400+ let mem_size = 128 << KIB_TO_BYTES_SHIFT ;
400401 let gm = arch_mem ( mem_size) ;
401402 let mut resource_allocator = ResourceAllocator :: new ( ) . unwrap ( ) ;
402403 configure_system (
@@ -421,7 +422,7 @@ mod tests {
421422 . unwrap ( ) ;
422423
423424 // Now assigning some memory that is equal to the start of the 32bit memory hole.
424- let mem_size = 3328 << 20 ;
425+ let mem_size = 3328 << KIB_TO_BYTES_SHIFT ;
425426 let gm = arch_mem ( mem_size) ;
426427 let mut resource_allocator = ResourceAllocator :: new ( ) . unwrap ( ) ;
427428 configure_system (
@@ -446,7 +447,7 @@ mod tests {
446447 . unwrap ( ) ;
447448
448449 // Now assigning some memory that falls after the 32bit memory hole.
449- let mem_size = 3330 << 20 ;
450+ let mem_size = 3330 << KIB_TO_BYTES_SHIFT ;
450451 let gm = arch_mem ( mem_size) ;
451452 let mut resource_allocator = ResourceAllocator :: new ( ) . unwrap ( ) ;
452453 configure_system (
0 commit comments