update yaxpeax-arm to 0.5.0 - #14
Conversation
this fixes a large slate of ARMv7/thumb decoding bugs. there are a number of places in `sp-emu` that note bugs in yaxpeax-arm and otherwise include in-tree ad-hoc decoding to work around not fixing those issues upstream; many of those can probably be removed now, but I'm not sure what all of them are nor what relevant testing is to know if there were load-bearing bugs that were fixed here. I'm not sure what all the places where sp-emu is working around upstream bugs are, or if all of them are commented as such, and given that most workarounds are "sp-emu will decode the bytes itself", presumably "reverting to using upstream as bugs are fixed" is not entirely straightforward. ---- this change is mostly a heads up about the update. I've run `cargo build` and `cargo test` with this change, and everything seems ok. but the existing behavior for what was RRX rotates seems incorrect, so I'm not sure how much of the ISA the test suite covers. in the RRX case, it should shift by one bit, rather than return `v` directly, so I assume no test program nor current Hubris build uses that particular rotate form in a codepath that sp-emu is asked to exercise.. you may want to re-evaluate the emulator or the necessity of workarounds in decoding with whichever tools (Claude?) you'd here.
|
Thanks for hopping in! This change is fine for the SP images because of the redecodes you mentioned, but I can definitely go through all the instances of those and remove the ones where 0.5 comes back clean. And can add more tests as well. Where this will be a problem is in the RoT side since that code ended up using the workarounds after a Back to the RRX point, I believe as you mentioned Hubris only uses standalone RRX and we only use what Hubris uses. But it's still a bug and I'll get it fixed. |
|
Was a search done for rrx instructions in rot binaries? |
|
the rrx instruction is different from the rrx rotate mode, which is encoded like "ror 0". previously, yaxpeax-arm did not decode "ror 0" into rrx as an ARM core would interpret it, which was both a bug and left the correct handling of that case up to library users. the handling of |
|
I built a RoT image from app/oxide-rot-1/app-dev.toml, had Claude search for RRX: |
|
@lzrd I think the RoT and bootleby are still going to have issues here. The RRX case was only one case. I was specifically commenting on the v8-M family of instructions. |
|
Okay, there are 31 spots in In 0.5 they decode successfully with no operands, and will fall through to an The If it's better to stick with a workaround till we can absorb all the new new with yaxpeax-arm 0.5, we'd want to route all LDA/LDAB/LDAH/STL/STLB/STLH/LDAEX*/STLEX* opcodes into |
|
As for the RRX side you're right, the RoTs and bootleby don't use RRX. |
I and several other contributors have fixed a large slate of ARMv7/thumb decoding bugs upstream. there are a number of places in
sp-emuthat note bugs in yaxpeax-arm and otherwise include in-tree ad-hoc decoding to work around not fixing those issues upstream; many of those can probably be removed now, but I'm not sure what all of them are nor what relevant testing is to know if there were load-bearing bugs that were fixed here.I'm not sure what all the places where sp-emu is working around upstream bugs are, or if all of them are commented as such, and given that most workarounds are "sp-emu will decode the bytes itself", presumably "reverting to using upstream as bugs are fixed" is not entirely straightforward.
this change is mostly a heads up about the update. I've run
cargo buildandcargo testwith this change, and everything seems ok. but the existing behavior for what was RRX rotates seems incorrect, so I'm not sure how much of the ISA the test suite covers.in the RRX case, it should shift by one bit, rather than return
vdirectly, so I assume no test program nor current Hubris build uses that particular rotate form in a codepath that sp-emu is asked to exercise.. you may want to re-evaluate the emulator or the necessity of workarounds in decoding with whichever tools (Claude?) you'd here.