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

How to understand the "convert an invalid address into some other invalid address" in 3.1.14 MEPC register description #1753

Open
rock-ifly opened this issue Dec 3, 2024 · 3 comments

Comments

@rock-ifly
Copy link

How to understand the "convert from an invlid address into some other invalid address"? why the converted address is also called invalid?

Does this relate to address size problem? that's to say for a PAW(PA width)=VAW(VA width) =48 hart, if pc=0xFFFF_ABCD_0000_0000,exception raise, then mepc should save a 48-bit PC( 0xABCD_0000_0000), not the 0xFFFF_ABCD_0000_0000?

mepc is a WARL register that must be able to hold all valid virtual addresses. It need not be capable of
holding all possible invalid addresses. Prior to writing mepc , implementations may convert an invalid
address into some other invalid address that mepc is capable of holding.

@gfavor
Copy link
Collaborator

gfavor commented Dec 3, 2024

You should (must) not convert an invalid address into a valid address. But you can convert an invalid address tha tis not representable in mepc to another invalid address that IS representable in mepc. This allows one to not have to represent all possible 64-bit address values if the largest supported valid address is less than 64 bits.

@rock-ifly
Copy link
Author

rock-ifly commented Dec 4, 2024

You should (must) not convert an invalid address into a valid address. But you can convert an invalid address tha tis not representable in mepc to another invalid address that IS representable in mepc. This allows one to not have to represent all possible 64-bit address values if the largest supported valid address is less than 64 bits.

OK, I see, that 's for the case when the largest supported valid address is less than 64 bits, people can just use the max valid address size in mepc register. Thanks!

@aswaterman
Copy link
Member

Or maybe the max valid address size plus one extra bit, so that it's straightforward to synthesize a different bad address. But yes, you have the right idea.

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

No branches or pull requests

3 participants