apple2e: fix -ramsize crash - #14486
Merged
Merged
Conversation
Ensure IIc memory expansion variables are initialized, mimicking device_reset() from a2bus_memexp_device. This fixes a crash booting ProDOS with -ramsize. Also followup 9deea88: initialize all of m_migram.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes apple2c* crashing when using -ramsize.
To reproduce:
On arm64 macos Sonoma 14.8.1, MAME 0.282 crashes while booting ProDOS:
zsh: segmentation fault ./appulatord apple2c3 -ramsize 1152K -flop1(this is an uninitialized memory bug, so the results may vary run-to-run or depend on OS-specific allocator behavior.)
After rebuilding with Asan (ARCHOPTS="-fsanitize=address") we can see:
SUMMARY: AddressSanitizer: BUS apple2e.cpp:874 in (anonymous namespace)::apple2e_state::memexp_w(unsigned int, unsigned char)mame_282_asan.txt
...and logging
m_exp_liveptrshows that the high byte is non-zero, i.e. beyond any possible apple2 allocation.The code updating
m_exp_wptrmasks out each of the low three bytes, but notice: the highest byte was never initialized...This commit adds initialization, mimicking the
device_reset()from a2bus_memexp_device (which works fine in apple2ee.)