Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPC: ca32 and ov32 flags and ppr32 missing #2900

Open
Rot127 opened this issue Aug 10, 2022 · 4 comments
Open

PPC: ca32 and ov32 flags and ppr32 missing #2900

Rot127 opened this issue Aug 10, 2022 · 4 comments
Labels

Comments

@Rot127
Copy link
Member

Rot127 commented Aug 10, 2022

Is your feature request related to a problem? Please describe.

The ISA v3 only ca32 and ov32 flags and register ppr32 are not implemented. While this is not a huge problem it prevents rz-tracetest to test mfxer instructions against QEMU traces binaries compiled for ISA v3.

mfxer copies a value from xer to a gpr register (and with it the ca32, ov32 flags).

QEMU and Rizin have a mismatch in register content here. QEMU will set and trace the flag bits whenever it runs a binary for ISAv3 (which is expected). But since Rizin does not support ISAv3 registers and flags the register content has a mismatch.

The rz-trace adapter has the possibility to change the register content for such cases but for the mfxer instruction it can only change the value of the xer register. Not the target gpr register. Hence this instruction fails in rz-tracetest because of the mismatch in the GPR register.

Describe the solution you'd like

Some kind of analysis.cpu = ISA300 option should be addded which uses a register profile with the ca32 and ov32 flags and ppr32.

Implementing the flags for all CPUs (also < v3 ones) will not work. BAPs QEMU does not add those flags to the trace for non v3 binaries.

Considered alternatives

None

Additional context
rz-tracetest needs to be fixed as well after this is implemented: https://github.com/rizinorg/rz-tracetest/blob/a819756a5627105f59d445707a7d0877171c540d/rz-tracetest/adapter.cpp#L181
Some of this was already implemented before: https://github.com/Rot127/rizin/tree/Examples-ppc-rzil-isav3-regs

@Rot127 Rot127 added enhancement New feature or request RzAnalysis RZIL labels Aug 10, 2022
@XVilka XVilka added the PPC label Aug 10, 2022
@Rot127 Rot127 changed the title PPC: ca32 and ov32 flags missing PPC: ca32 and ov32 flags and ppr32 missing Aug 10, 2022
@XVilka
Copy link
Member

XVilka commented Aug 11, 2022

Probably makes sense to open an issue in https://gitlab.com/qemu-project/qemu/-/issues

@Rot127
Copy link
Member Author

Rot127 commented Aug 11, 2022

This is not an issue in QEMU so there is no need for it. Edited the issue above to make this clear.

@XVilka
Copy link
Member

XVilka commented Jan 14, 2024

@Rot127 could you please review and address this since Capstone/Rizin support was improved since?

@Rot127
Copy link
Member Author

Rot127 commented Jan 14, 2024

Yes, though I would give it pretty low priority. The emulation works perfectly fine without them. Rizin just doesn't implement the ca32, ov32 flags. Which shouldn't be a problem usually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants