-
Notifications
You must be signed in to change notification settings - Fork 91
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
Type ambiguities/incosistencies #95
Comments
I would prefer just documenting the assumption that this is an LP64 ABI for RV64 and ILP32 ABI for RV32. That removes the definitional ambiguity without requiring significant changes. The problem with using explicitly-sized types is that they don't do the right thing when the size is supposed to change between RV64 and RV32. By contrast, in the standard RISC-V ABIs, |
Additionally, I don't believe the changes are particularly significant, and should have no effect on existing, conformant, programs. If they do have an effect, then that's either a specification oversight or a program bug. Being explicit is highly valuable in the context of a specification that defines foundational calling conventions, which this specification does. |
I think if its desired to keep C semantics, defining some |
@repnop Documenting which ABI is assumed is sufficient to convey the size of the C datatypes. I still prefer that approach, but I agree defining and using an XLEN-bit type is a suitable alternative. |
The current SBI specification assumes familiarity with C/C++ type widths, which I would argue is inappropriate for this level of documentation. I would like to see the type widths in use formally specified, ie:
In particular,
int
as used in the legacy console functions could be almost anything. There are also a number of functions where the explicitly-sized types are used as well as the implicity-sized ones:For uint64_t:
sbi_set_timer
,sbi_pmu_counter_config_matching
,sbi_pmu_counter_start
For uint32_t:
sbi_hart_suspend
sbi_system_reset
The
uint32_t
are particularly confusing, as otherwise the document implies pretty strongly thatlong
is 32 bits wide, and the examples above use bothlong
anduint32_t
. If there's some rationale for the use of both types, I didn't see it in the spec.I believe the appropriate thing to do is:
uint64_t
etc), andThe text was updated successfully, but these errors were encountered: