Conversation
HyperCPU emulator loads the executable file, calculates the size of executable code in it (aka "binary size"), and then allocates the memory for reading and executing the code. If the executable code is missing for some reason, emulator will fail with std::bad_alloc exception. This commit fixes this bug and adds a little check if the binary size is more than zero. Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
HyperCPU emulator runs the executable code until HALT command is sent. If the end of the code is reached, and there is no HALT command, emulator will continue reading and executing the code and finally abort with error like "Interrupt was triggered, but failed to execute handler" with XIP exceeding the size of the executable code (binary size). This commit implements automatic CPU halt in case XIP exceeds the binary size. Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
The previous solution in HyperCPU::CPU::Run() method could lead to performance degradation. Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
HyperCPU emulator will refuse binary file if its executable code size is lesser than declared in the header, or if its header is broken. Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
Most of the code responsible for binary file verification is now available in VerifyBinaryFile method. The emulator now refuses to run the binary file with a size less than default binary header size. Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
I wrongly typed !VerifyBinaryFile instead of VerifyBinaryFile. As a result, emulator could continue working in case VerifyBinaryFile returned 1 (error) or shutdown if 0 (no errors). Signed-off-by: Ivan Movchan <ivan.movchan.07@gmail.com>
AshFungor
approved these changes
Aug 22, 2025
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.
No description provided.