Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Block end callback fixes #36

Merged
merged 1 commit into from
Mar 8, 2018
Merged

Conversation

f4rnham
Copy link
Contributor

@f4rnham f4rnham commented Feb 19, 2018

P1
First part of this patch adds missing block end callback for indirect jump instructions.
The } else if (!TCGV_IS_UNUSED(jr)) { condition seems to be true when qemu translates jump to virtual register (indirect jumps/calls and even ret instructions).
Without this addition, callback was not triggered for such instructions.

P2
Second part tries to address issues with basic block ends being only subset of translation block ends.
Under certain conditions, like too long basic block or popf, sti, invlpg instructions, TB translation is terminated immediately even though basic block didn't end.
There could be some cases missing, but this still saves a lot of time and effort in scripts checking / disassembling prev_pc.

Alternative: documentation could be updated to reflect, that the callback triggers on translation block end and that basic block end checking can be done through multiple INSN_END_CB callbacks.

@xabiugarte
Copy link
Contributor

Hi,

I agree with P1, but I have some reservations with P2.

Given that the patch may not completely guarantee that BLOCK_END_CB matches basic block ends, it would bring inconsistencies and could be misleading for users using this callback to delimit basic blocks.

Given that QEMU divides blocks in translation blocks instead of actual basic blocks, I think it would be better to explain it properly in the documentation. Currently the documentation states "basic blocks" in several places, so I would perform a thorough revision to make sure that BLOCK_END_CB is clearly defined.

If you agree with this, I can merge P1 and open an issue to make sure the documentation gets updated properly.

Again, thanks a lot for your contributions! Let me know if we ever meet in person :-), and of course, feel free to contact me (by opening issues), or directly on twitter, if you have any feature requests.

Thanks!

@f4rnham
Copy link
Contributor Author

f4rnham commented Mar 6, 2018

Ok, I have updated this PR to include only the first commit.

Since it removed P2 from history, just for possible future reference https://gist.github.com/f4rnham/f337a84ff9cae53b48b44c9152518727

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

Successfully merging this pull request may close these issues.

None yet

2 participants