MCPcopy Create free account
hub / github.com/Mic92/vmsh / load_binary

Method load_binary

src/loader.rs:235–254  ·  view source on GitHub ↗
(
        &mut self,
        command: &[String],
        irq_num: usize,
        mmio_ranges: Vec<u64>,
    )

Source from the content-addressed store, hash-verified

233 }
234
235 pub fn load_binary(
236 &mut self,
237 command: &[String],
238 irq_num: usize,
239 mmio_ranges: Vec<u64>,
240 ) -> Result<(VirtMem, DeviceStatus, DriverStatus)> {
241 let binary = try_core_res!(ElfBinary::new(self.binary), "cannot parse elf binary");
242
243 self.string_arg_size = page_align(command.iter().map(|c| c.len() + 1).sum());
244 try_core_res!(binary.load(self), "cannot load elf binary");
245
246 let (device_status, driver_status) = try_with!(
247 self.write_stage1_args(command, irq_num, mmio_ranges),
248 "failed to write stage1 arguments"
249 );
250
251 try_with!(self.upload_binary(), "failed to upload binary to vm");
252 let mem = require_with!(self.virt_mem.take(), "BUG, no virtual memory assigned");
253 Ok((mem, device_status, driver_status))
254 }
255}
256
257type ElfResult = std::result::Result<(), ElfLoaderErr>;

Callers

nothing calls this directly

Calls 3

iterMethod · 0.80
page_alignFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected