-
Notifications
You must be signed in to change notification settings - Fork 55
[libunwind] Add c18n support on RISC-V #785
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2206,8 +2206,6 @@ inline const char *Registers_arm64::getRegisterName(int regNum) { | |
return "clr"; | ||
case UNW_ARM64_C31: | ||
return "csp"; | ||
case UNW_ARM64_ECSP: | ||
return "ecsp"; | ||
default: | ||
return "unknown register"; | ||
} | ||
|
@@ -4554,10 +4552,19 @@ class _LIBUNWIND_HIDDEN Registers_riscv { | |
void setSP(reg_t value) { _registers[2] = value; } | ||
reg_t getIP() const { return _registers[0]; } | ||
void setIP(reg_t value) { _registers[0] = value; } | ||
#ifdef __CHERI_PURE_CAPABILITY__ | ||
reg_t getTrustedStack() const { return _registers[32]; } | ||
void setTrustedStack(reg_t value) { _registers[32] = value; } | ||
#endif | ||
|
||
private: | ||
// _registers[0] holds the pc | ||
#ifdef __CHERI_PURE_CAPABILITY__ | ||
// _registers[32] holds the trusted stack pointer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just add another field after? PC is in element 0 because it makes indexing the array a bit easier for all the other registers, but there's no benefit AFAICT to (ab)using a 33rd register for the trusted stack pointer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The constructor An alternative is to put the field after the floating point registers. But then the assembly code which saves and restores the registers would have to condition the offset of the trusted stack register on whether
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. # if defined(__riscv_flen)
const uint8_t *floats = static_cast<const uint8_t *>(registers);
# if defined(__CHERI_PURE_CAPABILITY__)
floats += sizeof(_whatever_you_call_the_field);
# endif
floats += sizeof(_registers);
memcpy(_floats, floats, sizeof(_floats));
# endif ? |
||
reg_t _registers[33]; | ||
#else | ||
reg_t _registers[32]; | ||
#endif | ||
# if defined(__riscv_flen) | ||
fp_t _floats[32]; | ||
# endif | ||
|
@@ -4568,8 +4575,8 @@ inline Registers_riscv::Registers_riscv(const void *registers) { | |
"riscv registers do not fit into unw_context_t"); | ||
memcpy(&_registers, registers, sizeof(_registers)); | ||
# ifdef __CHERI_PURE_CAPABILITY__ | ||
static_assert(sizeof(_registers) == 0x200, | ||
"expected float registers to be at offset 512"); | ||
static_assert(sizeof(_registers) == 0x210, | ||
"expected float registers to be at offset 528"); | ||
# elif __riscv_xlen == 32 | ||
static_assert(sizeof(_registers) == 0x80, | ||
"expected float registers to be at offset 128"); | ||
|
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 in an earlier iteration of the patch we really did need it to be a DWARF register?..