Skip to main content

sys_vmm_load_disk

Function sys_vmm_load_disk 

Source
pub fn sys_vmm_load_disk(
    vmm_handle: u64,
    image_ptr: u64,
    image_len: u64,
) -> Result<u64, SyscallError>
Expand description

SYS_VMM_LOAD_DISK (593): replaces a world’s block-device image.

arg1 = VMM capability handle (write permission required), arg2 = user pointer to the image bytes, arg3 = image length: non-zero, a multiple of VMM_DISK_SECTOR_SIZE, at most VMM_DISK_MAX_BYTES.

The bytes are copied into a bounded kernel buffer, then vm::load_disk replaces the device content: image first, zero-fill after it, grow-only (never shrink), and at least strat9_abi::vmm::VMM_DISK_DEFAULT_BYTES of capacity. Intended to be called before the guest boots; when the device grows its virtio transport state is reset (the read-only mode is preserved). Returns 0.