Skip to content

2025-07-17 bugfixes#38

Merged
AshFungor merged 8 commits intomasterfrom
2025-07-17-bugfixes
Aug 22, 2025
Merged

2025-07-17 bugfixes#38
AshFungor merged 8 commits intomasterfrom
2025-07-17-bugfixes

Conversation

@ivan-movchan
Copy link
Contributor

No description provided.

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 AshFungor merged commit 109c989 into master Aug 22, 2025
11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants