kvmtool: handle x86 firmware smaller than 128k
PATCH v2 1/1 kvmtool: handle x86 firmware smaller than 128k
Firmware images smaller than the bios memory region (0xe0000 -> 0xfffff) must be mapped at the end if the region because the x86 cpu reset vector is 0xffff0.
Signed-off-by Gerd Hoffmann <[email protected]>
--- x86/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
x86/boot.c +1 -1
@@ -28,7 +28,7 @@ bool kvm__load_firmware(struct kvm *kvm, const char *firmware_filename)if (st.st_size >MB_FIRMWARE_BIOS_SIZE )die ("firmware image %s is too big to fit in memory (%Lu KB).\n" , firmware_filename, (u64)(st.st_size /1024 )); - p =guest_flat_to_host (kvm,MB_FIRMWARE_BIOS_BEGIN ); + p =guest_flat_to_host (kvm,MB_BIOS_END +1 - st.st_size);while ((nr =read (fd, p, st.st_size)) >0 ) p += nr;
Signature · 1 line
2.9.3
Hi Gerd,
Small typo in the commit message, but otherwise looks good.
Quoted 2 lines · Gerd Hoffmann
Firmware images smaller than the bios memory region (
0xe0000->0xfffff) must be mapped at the end if the region because the x86 cpu reset vector
s/if/of/
Quoted 2 lines
is
0xffff0.
Reviewed-by Darren Kenny <[email protected]>
Thanks,
Darren.
Quoted 21 lines
Signed-off-by Gerd Hoffmann <[email protected]>---
x86/boot.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)x86/boot.c +1
-1@@ -28,7 +28,7 @@ bool kvm__load_firmware(struct kvm *kvm, const char *firmware_filename)if (st.st_size >MB_FIRMWARE_BIOS_SIZE )die ("firmware image %s is too big to fit in memory (%Lu KB).\n" , firmware_filename, (u64)(st.st_size /1024 )); - p =guest_flat_to_host (kvm,MB_FIRMWARE_BIOS_BEGIN ); + p =guest_flat_to_host (kvm,MB_BIOS_END +1 - st.st_size);while ((nr =read (fd, p, st.st_size)) >0 ) p += nr;Signature · 1 line
2.9.3