Instruction-level dynamic tracing

From: Christos Margiolis <christos_at_freebsd.org>
Date: Sat, 01 Oct 2022 16:00:15 UTC
Hello,

Me and markj@ implemented a new DTrace provider (kinst) that allows for
arbitrary kernel instruction tracing. The provider is currently
implemented only for amd64, but we plan to port it to other
architectures in the future as well.

kinst probes take the form of:
	
	kinst:<module>:<function>:<offset>

where "function" is the kernel function to be traced, and "offset" is
the offset to a specific instruction. This offset can be obtained from
the function's disassembly using kgdb.

For example, if I want to trace the second instruction in
amd64_syscall(), I first need to figure out the offset to the
second instruction:

	# kgdb
	(kgdb) disas /r amd64_syscall
	Dump of assembler code for function amd64_syscall:
	   0xffffffff809256c0 <+0>:     55      push   %rbp
	   0xffffffff809256c1 <+1>:     48 89 e5        mov    %rsp,%rbp
	   0xffffffff809256c4 <+4>:     41 57   push   %r15

The offset is 1. To trace it:

	# dtrace -n 'kinst::amd64_syscall:1'

Final code review: https://reviews.freebsd.org/D36851
Any review of the code would be appreciated.

Christos