diff --git a/bochs/iodev/hdimage/hdimage.cc b/bochs/iodev/hdimage/hdimage.cc index 05818ffc5..49fb07967 100644 --- a/bochs/iodev/hdimage/hdimage.cc +++ b/bochs/iodev/hdimage/hdimage.cc @@ -2004,6 +2004,8 @@ int undoable_image_t::open(const char* pathname, int flags) if (mode == BX_HDIMAGE_MODE_UNKNOWN) { BX_PANIC(("r/o disk image mode not detected")); return -1; + } else { + BX_INFO(("base image mode = '%s'", hdimage_mode_names[mode])); } ro_disk = DEV_hdimage_init_image(mode, 0, NULL); if (ro_disk == NULL) { @@ -2139,6 +2141,8 @@ int volatile_image_t::open(const char* pathname, int flags) if (mode == BX_HDIMAGE_MODE_UNKNOWN) { BX_PANIC(("r/o disk image mode not detected")); return -1; + } else { + BX_INFO(("base image mode = '%s'", hdimage_mode_names[mode])); } ro_disk = DEV_hdimage_init_image(mode, 0, NULL); if (ro_disk == NULL) { diff --git a/bochs/iodev/hdimage/vmware4.cc b/bochs/iodev/hdimage/vmware4.cc index 9a53bfd4a..44cc7910f 100644 --- a/bochs/iodev/hdimage/vmware4.cc +++ b/bochs/iodev/hdimage/vmware4.cc @@ -86,7 +86,7 @@ int vmware4_image_t::open(const char* _pathname, int flags) is_dirty = 0; hd_size = header.total_sectors * SECTOR_SIZE; - cylinders = (unsigned)hd_size / (16 * 63); + cylinders = (unsigned)(header.total_sectors / (16 * 63)); heads = 16; spt = 63; diff --git a/bochs/misc/bxcompat.h b/bochs/misc/bxcompat.h index 76ecd3383..e11802d3f 100644 --- a/bochs/misc/bxcompat.h +++ b/bochs/misc/bxcompat.h @@ -59,6 +59,8 @@ enum { #define BX_HDIMAGE_MODE_LAST BX_HDIMAGE_MODE_VPC #define BX_HDIMAGE_MODE_UNKNOWN -1 +extern const char *hdimage_mode_names[]; + // definitions for compatibility with Bochs #ifndef UNUSED # define UNUSED(x) ((void)x) diff --git a/bochs/misc/bximage.cc b/bochs/misc/bximage.cc index 648c25383..4d1979e46 100644 --- a/bochs/misc/bximage.cc +++ b/bochs/misc/bximage.cc @@ -81,6 +81,22 @@ const int bx_max_hd_megs = (int)(((1 << BX_MAX_CYL_BITS) - 1) * 16.0 * 63.0 / 2048.0); +const char *hdimage_mode_names[] = { + "flat", + "concat", + "external", + "dll", + "sparse", + "vmware3", + "vmware4", + "undoable", + "growing", + "volatile", + "vvfat", + "vpc", + NULL +}; + int bximage_mode; int bx_hdimage; int bx_fdsize_idx; @@ -641,8 +657,11 @@ void convert_image(int newimgmode, Bit64u newsize) if (mode == -1) { mode = hdimage_detect_image_mode(bx_filename_1); } - if (mode == BX_HDIMAGE_MODE_UNKNOWN) + if (mode == BX_HDIMAGE_MODE_UNKNOWN) { fatal("source disk image mode not detected"); + } else { + BX_INFO(("source image mode = '%s'", hdimage_mode_names[mode])); + } source_image = init_image(mode); if (source_image->open(bx_filename_1, O_RDONLY) < 0)