Page MenuHomeFreeBSD

dtrace: add register bindings for RISC-V
ClosedPublic

Authored by christos on Apr 17 2023, 2:01 AM.
Referenced Files
Unknown Object (File)
Mon, Apr 29, 12:28 AM
Unknown Object (File)
Mar 11 2024, 10:26 AM
Unknown Object (File)
Mar 11 2024, 10:26 AM
Unknown Object (File)
Mar 8 2024, 12:23 AM
Unknown Object (File)
Mar 8 2024, 12:23 AM
Unknown Object (File)
Mar 8 2024, 12:23 AM
Unknown Object (File)
Mar 8 2024, 12:23 AM
Unknown Object (File)
Mar 8 2024, 12:23 AM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

cddl/lib/libdtrace/regs_riscv.d
25–26

S0 is also the Frame Pointer. Can you add another entry giving it the alias R_FP?

sys/cddl/dev/dtrace/riscv/dtrace_isa.c
324

I think specifying a range in this way is a GNU extension, not standard C syntax, and it should be avoided. Unfortunately that makes this code a lot uglier :(

christos added inline comments.
cddl/lib/libdtrace/regs_riscv.d
25–26

Yeah. I had initially added R_FP as well but I rewrote the file and forgot to add it.

sys/cddl/dev/dtrace/riscv/dtrace_isa.c
324

There are other code pieces that use this as well, I don't think that's too much of an issue,
but if you and @markj insist, I can get rid of it.

christos marked an inline comment as done.

Add FP.

cddl/lib/libdtrace/regs_riscv.d
9

Technically this should be 1.13, not 1.0. It comes from DT_VERS_STRING in libdtrace.

sys/cddl/dev/dtrace/riscv/dtrace_isa.c
324

It is a GNU extension, but we do use it a fair bit already[*], especially in bhyve. I'd vote for keeping it since it makes the code easier to follow.

[*]$ git grep 'case.*\.\.\..*:'

christos added inline comments.
sys/cddl/dev/dtrace/riscv/dtrace_isa.c
324

I'll leave it as is.

christos added inline comments.
cddl/lib/libdtrace/regs_riscv.d
9

Should the version in regs_x86.d be bumped as well?

christos marked an inline comment as done.

Bump version to 1.13.

mhorne added inline comments.
sys/cddl/dev/dtrace/riscv/dtrace_isa.c
324

Sounds great.

336–341

Nit: the final return statement will never execute due to the default case. You can use __assert_unreachable() instead.

This revision is now accepted and ready to land.Apr 17 2023, 4:51 PM
sys/cddl/dev/dtrace/riscv/dtrace_isa.c
336–341

Won't a /* NOTREACHED */ comment suffice?

christos marked 2 inline comments as done.

Add /* NOTREACHED */ at the end of dtrace_getreg().

This revision now requires review to proceed.Apr 17 2023, 7:59 PM
This revision is now accepted and ready to land.Apr 17 2023, 8:52 PM
markj added inline comments.
cddl/lib/libdtrace/regs_riscv.d
9

No, the binding reflects the current libdtrace version at the time that the definitions were introduced. The x86 register bindings have been there since the beginning.

This revision was automatically updated to reflect the committed changes.