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

Avoid notdirty_write #1839

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Avoid notdirty_write #1839

wants to merge 1 commit into from

Conversation

tunz
Copy link

@tunz tunz commented May 30, 2023

Attempt to avoid notdirty_write as much as possible. Please refer to #1838 for the context.

If there is no TB in the page, we can skip the slow path, so mark the TLB as dirty in such case. And PageDesc is allocated only when TB is generated, so we can apply the same logic for the case where PageDesc is not found.

If Unicorn generates a TB, we have to take the slow path for the page. In tb_page_add, if it's the first tb generated, tlb_protect_code will be called, and it will call cpu_physical_memory_test_and_clear_dirty. In this function, we reset the dirty flag so that Unicorn calls notdirty_write when memory is overwritten in the page.

Tested with tests/regress/x86_self_modifying.py.

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

Successfully merging this pull request may close these issues.

None yet

1 participant