Page MenuHomeFreeBSD

riscv: add FPE code
ClosedPublic

Authored by br on Jun 22 2024, 6:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 4:41 AM
Unknown Object (File)
Tue, Nov 19, 8:34 PM
Unknown Object (File)
Tue, Nov 19, 8:42 AM
Unknown Object (File)
Tue, Nov 19, 8:29 AM
Unknown Object (File)
Tue, Nov 19, 6:31 AM
Unknown Object (File)
Mon, Nov 11, 6:06 PM
Unknown Object (File)
Fri, Nov 8, 4:53 AM
Unknown Object (File)
Tue, Nov 5, 5:32 AM
Subscribers

Details

Reviewers
mhorne
Group Reviewers
riscv
Commits
rG44d4ee7f3dad: riscv: add FPE code.
Summary

add floating point extension (FPE) code needed for bhyve and vmm_switch()

Diff Detail

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

Event Timeline

br requested review of this revision.Jun 22 2024, 6:29 PM
br created this revision.
jrtc27 added inline comments.
sys/riscv/riscv/fpe.c
106

This doesn't capture the memory side-effects. You either need a : "memory" in there (a big hammer, though probably doesn't make much difference here) or an extra dummy operand "=m"(*(uint64_t (*)[32][2])fp_x).

sys/riscv/riscv/fpe.c
106

Though if doing the latter, probably nicer to do:

uint64_t fcsr, (*fp_x)[32][2];

fp_x = &regs->fp_x;

and then you don't need to cast in the inline assembly, just "=m"(*fp_x).

(Yes, the syntax for a pointer to an array is real, if extremely rarely used, and yes it should remind you of function pointers...)

  • Add dummy operand "m" to tell compiler which memory we read/write via pointers.
  • Ensure all operands are output in fpe_store() and input in fpe_restore().

Thanks for this. One tweak required.

sys/riscv/riscv/fpe.c
177
191
This revision is now accepted and ready to land.Jun 24 2024, 6:55 PM
This revision was automatically updated to reflect the committed changes.