@@ -21,6 +21,8 @@ use alloc::vec::Vec;
2121use arraydeque:: ArrayDeque ;
2222use spin:: RwLock ;
2323
24+ static BIOS_BLOB : & ' static [ u8 ] = include_bytes ! ( "blob/bios.bin" ) ;
25+
2426static VIRTUAL_MACHINES : RoAfterInit < VirtualMachines > =
2527 RoAfterInit :: uninitialized ( ) ;
2628
@@ -218,7 +220,6 @@ pub struct PhysicalDeviceConfig {
218220pub struct VirtualMachineConfig {
219221 cpus : Vec < percore:: CoreId > ,
220222 images : Vec < ( String , GuestPhysAddr ) > ,
221- bios : Option < String > ,
222223 virtual_devices : DeviceMap ,
223224 physical_devices : PhysicalDeviceConfig ,
224225 memory : u64 , // in MB
@@ -241,7 +242,6 @@ impl VirtualMachineConfig {
241242 images : vec ! [ ] ,
242243 virtual_devices : DeviceMap :: default ( ) ,
243244 physical_devices : physical_devices,
244- bios : None ,
245245 memory : memory,
246246 }
247247 }
@@ -259,18 +259,6 @@ impl VirtualMachineConfig {
259259 Ok ( ( ) )
260260 }
261261
262- /// Specify that the given image 'path' should be mapped as the BIOS
263- ///
264- /// The precise meaning of `image` will vary by platform. This will be a
265- /// value suitable to be passed to `VmServices::read_file`.
266- ///
267- /// The BIOS image will be mapped such that the end of the image is at
268- /// 0xffffffff and 0xfffff (i.e., it will be mapped in two places)
269- pub fn map_bios ( & mut self , bios : String ) -> Result < ( ) > {
270- self . bios = Some ( bios) ;
271- Ok ( ( ) )
272- }
273-
274262 /// Access the configurations virtual `DeviceMap`
275263 pub fn virtual_devices ( & self ) -> & DeviceMap {
276264 & self . virtual_devices
@@ -398,25 +386,15 @@ impl VirtualMachine {
398386 Self :: map_data ( data, addr, space)
399387 }
400388
401- fn map_bios (
402- bios : & str ,
403- space : & mut GuestAddressSpace ,
404- info : & BootInfo ,
405- ) -> Result < ( ) > {
406- let data = info
407- . find_module ( bios)
408- . ok_or_else ( || {
409- Error :: InvalidValue ( format ! ( "No such bios '{}'" , bios) )
410- } ) ?
411- . data ( ) ;
412- let bios_size = data. len ( ) as u64 ;
389+ fn map_bios ( space : & mut GuestAddressSpace ) -> Result < ( ) > {
390+ let bios_size = BIOS_BLOB . len ( ) as u64 ;
413391 Self :: map_data (
414- data ,
392+ BIOS_BLOB ,
415393 & memory:: GuestPhysAddr :: new ( ( 1024 * 1024 ) - bios_size) ,
416394 space,
417395 ) ?;
418396 Self :: map_data (
419- data ,
397+ BIOS_BLOB ,
420398 & memory:: GuestPhysAddr :: new ( ( 4 * 1024 * 1024 * 1024 ) - bios_size) ,
421399 space,
422400 )
@@ -429,9 +407,7 @@ impl VirtualMachine {
429407 let mut guest_space = GuestAddressSpace :: new ( ) ?;
430408
431409 // First map the bios
432- if let Some ( ref bios) = config. bios {
433- Self :: map_bios ( & bios, & mut guest_space, info) ?;
434- }
410+ Self :: map_bios ( & mut guest_space) ?;
435411
436412 // Now map any guest iamges
437413 for image in config. images . iter ( ) {
0 commit comments