freebsd-dev/sys/riscv/riscv
John Baldwin 232d0b87e0 Various fixes for floating point on RISC-V.
- Explicitly load an empty initial state into FP registers when taking
  the fault on the first FP instruction in a thread.  Setting
  SSTATE.FS to INITIAL is just a marker to let context switch restore
  code know that it can load FP registers with zeroes instead of
  memory loads.  It does not imply that the hardware will reset all
  registers to zero on first access.  In addition, set the state to
  CLEAN instead of INITIAL after the first FP instruction.
  cpu_switch() doesn't do anything for INITIAL and only restores from
  the pcb if the state is CLEAN.  We could perhaps change cpu_switch
  to call fpe_state_clear if the state was INITIAL and leave SSTATE.FS
  set to INITIAL instead of CLEAN after the first FP instruction.
  However, adding this complexity to cpu_switch() doesn't seem worth
  the supposed gain.
- Only save the current FPU registers in fill_fpregs() if the request
  is made to save the current thread's registers.  Previously if a
  debugger requested FP registers via ptrace() it was getting a copy
  of the debugger's FP registers rather than the debugee's.
- Zero the entire FP register set structure returned for ptrace() if a
  thread hasn't used FP registers rather than leaking garbage in the
  fp_fcsr field.
- If a debugger writes FP registers via ptrace(), always mark the pcb
  as having valid FP registers and set SSTATUS.FS_MASK to CLEAN so
  that the registers will be restored when the debugged thread
  resumes.
- Be more explicit about clearing the SSTATUS.FS field before setting
  it to CLEAN on the first FP instruction trap.

Submitted by:	br, markj
Approved by:	re (rgrimes)
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D17141
2018-09-19 23:45:18 +00:00
..
autoconf.c
bus_machdep.c
bus_space_asm.S
busdma_machdep.c
clock.c
copyinout.S Permit supervisor to access user VA space for certain functions only. 2018-09-05 11:34:58 +00:00
copystr.c
cpufunc_asm.S
db_disasm.c Rewrite RISC-V disassembler: 2018-08-14 16:03:03 +00:00
db_interface.c
db_trace.c
dump_machdep.c
elf_machdep.c Use elf_relocaddr() to find the address for R_RISCV_RELATIVE 2018-09-12 08:12:34 +00:00
exception.S Permit supervisor to access user VA space for certain functions only. 2018-09-05 11:34:58 +00:00
genassym.c
identcpu.c
in_cksum.c
intr_machdep.c o Add driver for PLIC (Platform-Level Interrupt Controller) device. 2018-06-12 17:45:15 +00:00
locore.S Permit supervisor to access user VA space for certain functions only. 2018-09-05 11:34:58 +00:00
machdep.c Various fixes for floating point on RISC-V. 2018-09-19 23:45:18 +00:00
mem.c
minidump_machdep.c
mp_machdep.c Eliminate kmem_malloc()'s unused arena parameter. (The arena parameter 2018-08-21 16:43:46 +00:00
nexus.c o Add driver for PLIC (Platform-Level Interrupt Controller) device. 2018-06-12 17:45:15 +00:00
ofw_machdep.c
plic.c PLIC driver was sponsored by ECATS contract, not CTSRD one. 2018-06-21 11:52:09 +00:00
pmap.c Remove {max/min}_offset() macros, use vm_map_{max/min}() inlines. 2018-08-29 12:24:19 +00:00
riscv_console.c
soc.c Embed a simplebus_softc in struct soc_softc. 2018-07-24 21:02:11 +00:00
stack_machdep.c
support.S Permit supervisor to access user VA space for certain functions only. 2018-09-05 11:34:58 +00:00
swtch.S Various fixes for floating point on RISC-V. 2018-09-19 23:45:18 +00:00
sys_machdep.c
timer.c o Add driver for PLIC (Platform-Level Interrupt Controller) device. 2018-06-12 17:45:15 +00:00
trap.c Various fixes for floating point on RISC-V. 2018-09-19 23:45:18 +00:00
uio_machdep.c
uma_machdep.c Implement uma_small_alloc(), uma_small_free(). 2018-08-08 16:08:38 +00:00
unwind.c
vm_machdep.c Permit supervisor to access user VA space for certain functions only. 2018-09-05 11:34:58 +00:00