Page MenuHomeFreeBSD

riscv: add FPE code
ClosedPublic

Authored by br on Sat, Jun 22, 6:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 26, 2:59 AM
Unknown Object (File)
Tue, Jun 25, 5:10 PM
Unknown Object (File)
Tue, Jun 25, 11:52 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.Sat, Jun 22, 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.Mon, Jun 24, 6:55 PM
This revision was automatically updated to reflect the committed changes.