armv4t_emu icon indicating copy to clipboard operation
armv4t_emu copied to clipboard

Panic on certain bad CPSR values

Open omarandlorraine opened this issue 2 years ago • 1 comments

I'm running into a panic here:

https://github.com/daniel5151/armv4t_emu/blob/7146935b514124f2ce5b1a911a81790c51b1e4c0/src/reg.rs#L118

My program terminates with:

thread 'main' panicked at /home/omarandlorraine/.cargo/registry/src/index.crates.io-6f17d22bba15001f/armv4t_emu-0.1.0/src/reg.rs:118:14:
CPSR contained invalid mode bits

I can see the comment says,

expect should never be fired, as mode bits are checked to be valid when setting the CPSR value.

I would guess that check is incorrect. Or, perhaps the check does not happen in all circumstances that influence CPSR.

My project needs to be able to run even badly behaving programs. Is this out of scope for armv4t_emu?

omarandlorraine avatar Nov 14 '23 12:11 omarandlorraine

Thanks for reporting the issue!

I don't think fixing this would be out of scope for the project (assuming you can point out the relevant part(s) of the ARM spec / other work folks have done to clarify what you expect the behaviour to be).

So long as it doesn't break existing code, and wouldn't result in an "incorrect" implementation, I'd be more than happy to review and merge any PR sent my way :)

daniel5151 avatar Nov 14 '23 14:11 daniel5151