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

Use better types for virtual memory translation code #637

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Timmmm
Copy link
Collaborator

@Timmmm Timmmm commented Dec 6, 2024

Change the VM code from using bits(64) everywhere to using more accurate types. This also enables Sv57 support.

@Timmmm
Copy link
Collaborator Author

Timmmm commented Dec 6, 2024

I wrote this code quite a while ago and kind of got sidetracked by other stuff, but it looks like I finished it so I thought I may as well push a draft and see what people think. It hasn't been tested extensively yet but I can do that.

One slightly awkward thing I found is that you can use really nice strict types everywhere for the actual translation because the lifetime of sv_width is the scope of the translation function, so it can only have one value. But you can't really do it for the TLB because the lifetime of sv_width for the TLB is infinite so you can end up storing Sv39 addresses in it one cycle and the Sv57 a few cycles later. I just used the widths for Sv57 (the max) and then truncate/zero_extend as appropriate.

Copy link

github-actions bot commented Dec 6, 2024

Test Results

396 tests  ±0   396 ✅ ±0   0s ⏱️ ±0s
  4 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit dcb8d5b. ± Comparison against base commit 3707d0b.

♻️ This comment has been updated with latest results.

@Timmmm Timmmm force-pushed the user/timh/ptw_nice_types branch from 55e080e to 8c15f7c Compare December 10, 2024 10:21
Change the VM code from using `bits(64)` everywhere to using more accurate types. This also enables Sv57 support.
@Timmmm Timmmm force-pushed the user/timh/ptw_nice_types branch from 8c15f7c to dcb8d5b Compare December 19, 2024 11:23
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.

1 participant