[Development report #8] Improve the kinst DTrace provider

From: Christos Margiolis <christos_at_freebsd.org>
Date: Fri, 28 Apr 2023 14:11:41 UTC
A brief overview of the things I've been working on since the last

* The RISC-V port of kinst was crashing if we tried to access
  the address pointed to by `frame->tf_tp`. This was a result of TP
  being unitialized if accessed by DTrace in probe context. I wrote a
  patch [1] which saves the thread pointer in both userland and kernel
  mode exceptions.
* Emulated all PC-relative RV64[IC] instructions.
* Fixed various bugs in both the emulation and the double breakpoint
  mechanism. There is however still an unsolved bug which hangs the
  system if we try to trace a very specific block of instructions in
  vm_fault() (instructions 4436 to 4450). Once this is fixed, the RISC-V
  port will most likely be complete.
* Added register bindings to RISC-V DTrace [2].
* Exposed dtrace_instr_size() to userland and implemented it for RISC-V
  [3]. Other architectures are meant to also implement this function as
  well and use it across DTrace code.
* In report #5 I mentioned that cpu_switch() was safe to trace. It turns
  out it's not.
* Submitted and working on various as-of-now open PRs related to DTrace
  and kinst.

[1] https://cgit.freebsd.org/src/commit/?id=d95fbf4e1a12565908b04b442263fe60c9e890b4
[2] https://cgit.freebsd.org/src/commit/?id=1fef7abdc76bd6f0c93775bd0c1b62b523abd20d
[3] https://cgit.freebsd.org/src/commit/?id=080e56a6c98c7e7a241a4260d4c19d3cad5b22af