-
Notifications
You must be signed in to change notification settings - Fork 46
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 named constants in the switcher #339
Conversation
af59dd8
to
4d21cc6
Compare
* macro will report an error if the provided value does not equal the constexpr | ||
* evaluation of `expression`. | ||
*/ | ||
# define EXPORT_ASSEMBLY_NAME(name, val) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me a minute to work out why we need both of these macros. I guess this one is just the same as EXPORT_ASSEMBLY_EXPRESSION(name, name, val)
but without a name collision? That makes me think maybe we should use {}
around the definition below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want the names available in C++, maybe, and the invoking source could, in principle, choose to put things in scope to hide them if desired, but because these are otherwise at top-level, just using {}
doesn't do the trick, eliciting "expected unqualified-id" errors from the compiler.
@@ -75,6 +75,7 @@ namespace priv | |||
constexpr size_t MCAUSE_LOAD_PAGE_FAULT = 13; | |||
constexpr size_t MCAUSE_STORE_PAGE_FAULT = 15; | |||
constexpr size_t MCAUSE_THREAD_EXIT = 24; | |||
constexpr size_t MCAUSE_THREAD_INTERRUPT = 25; | |||
constexpr size_t MCAUSE_CHERI = 28; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a separate PR but these constants are needed in error handlers so we should make them more publicly available in the SDK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public heading (and this is why I don't like abbreviations in names of things: priv is short for 'privileged spec' not 'private').
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess there's nothing stopping users from include priv/riscv.h
it just seems a bit weird. At any rate we should do this in relevant places in the examples/tests.
1bdb9d3
to
da330fe
Compare
da330fe
to
8e7188c
Compare
These are not really "trusted stack", and we're about to have some more. While here, tweak a comment as per Robert's suggestion. Co-authored-by: Robert Norton <[email protected]>
Co-authored-by: Robert Norton <[email protected]>
Co-authored-by: Robert Norton <[email protected]>
8e7188c
to
c661519
Compare
Pull yet more out of #320. Thanks to @rmn30 for the suggestion to make these self-check a la
assembly-helpers.h
.