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

Unbreak -icount mode for RISC-V. #243

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion target/riscv/op_helper_cheri.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ void HELPER(cspecialrw)(CPUArchState *env, uint32_t cd, uint32_t cs,
{
uintptr_t _host_return_address = GETPC();
// Ensure that env->PCC.cursor is correct:
cpu_restore_state(env_cpu(env), _host_return_address, false);
/*
* This breaks -icount because it triggers early deallocation of the TB.
* It seems that it is only required for logging anyway.
*/
/* cpu_restore_state(env_cpu(env), _host_return_address, false); */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is needed to read PCC correctly - we need a cursor that is up to date. But maybe the PC is already saved, might be possible to just assert that pc is current instead of calling this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-enabled this and I can't seem to be able to reproduce the -icount bug. I suspect one of the latest merges with upstream qemu changed the code that invalidates the TB. I am hitting a loop condition that seems to trigger an interrupt loop in CheriBSD with -icount auto though. This is an unrelated problem, but I'm not sure how we can fix it.


assert(index <= 31 && "Bug in translator?");
enum SCRAccessMode mode = scr_info[index].access;
Expand Down
Loading