Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Large VHD image files #78

Closed
fysnet opened this issue Sep 18, 2023 · 2 comments
Closed

Large VHD image files #78

fysnet opened this issue Sep 18, 2023 · 2 comments

Comments

@fysnet
Copy link
Collaborator

fysnet commented Sep 18, 2023

If I have a considerably large VHD file, ~32Gig used/128Gig total usable size, Bochs returns a PANIC at line 325 in harddrv.cc

BX_PANIC(("ata%d-%d: could not open hard drive image file '%s'", channel, device, SIM->get_param_string("path", base)->getptr()));

The offending code is in vpc.cc, line 173:

if (sector_count >= 65535 * 16 * 255) {
  bx_close_image(fd, pathname);
  return -EFBIG;
}

I understand that the VHD specification states that a CHS value limit is 65535/16/63. However, this doesn't mean that Bochs shouldn't be able to access up to the actual 2TB limitation of the VHD when reading sectors, correct?

Therefore, what is the reason for the check at line 173 in vpc.cc shown above? I don't believe it is needed, unless there is somewhere in the Bochs source that relies on the limitation of a CHS value of 65535/16/63. The only limitation would be in the BIOS and it can't access anything past the 1024/254/63 mark anyway, right?

However, if it is actually needed, an additional error to the log file might be warranted. Maybe something like:

if (sector_count >= 65535 * 16 * 255) {
  bx_close_image(fd, pathname);
  BX_ERROR(("VHD file too large: " FMT_LL "u", sector_count));
  return -EFBIG;
}

Thank you,
Ben

@stlintel
Copy link
Contributor

The VPC disk image code was ported from QEMU to Bochs.
I think you might try to look into QEMU code and see if the limitation is hard or not.
About the BX_ERROR -> just trivial, submit PR and it will be merged immediatelly

@fysnet
Copy link
Collaborator Author

fysnet commented Sep 18, 2023

See PR #79
This was ported from newer QEMU code.
https://gitlab.com/qemu-project/qemu/-/blob/master/block/vpc.c?ref_type=heads#L305

@fysnet fysnet closed this as completed Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants