aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl/dev/dtrace
Commit message (Collapse)AuthorAgeFilesLines
* dtrace: Implement ustackdepth for arm64Mark Johnston11 days1-2/+14
| | | | | MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D52475
* zfs: fix build after openzfs/zfs@e63d026b9Martin Matuska2025-11-171-0/+3
| | | | | Fix Makefiles Update zfs_config.h and zfs_gitrev.h
* dtrace: Deduplicate dtrace_sync() and dtrace_xcall() implementationsMark Johnston2025-09-186-154/+0
| | | | | | | | | dtrace_xcall() is just a thin wrapper around smp_rendezvous_cpus(). There's no need for six identical implementations to live in MD layers. No functional change intended. MFC after: 2 weeks
* dtrace/arm64: Fix dtrace_gethrtime()Mark Johnston2025-03-101-2/+31
| | | | | | | | | | | | | | | | | | | | | This routine returns a monotonic count of the number of nanoseconds elapsed since the previous call. On arm64 it uses the generic system timer. The implementation multiplies the counter value by 10**9 then divides by the counter frequency, but this multiplication can overflow. This can result in trace records with non-monotonic timestamps, which breaks libdtrace's temporal ordering algorithm. An easy fix is to reverse the order of operations, since the counter frequency will in general be smaller than 10**9. (In fact, it's mandated to be 1Ghz in ARMv9, which makes life simple.) However, this can give a fair bit of error. Adopt the calculation used on amd64, with tweaks to handle frequencies as low as 1MHz: the ARM generic timer documentation suggests that ARMv8 timers are typically in the 1MHz-50MHz range, which is true on arm64 systems that I have access to. MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D49244
* Revert "dtrace/arm64: Simplify dtrace_getarg() slightly"Mark Johnston2025-01-291-1/+3
| | | | | | | | | The change is clearly wrong as it removes a dereference of the pointer into the stack. Just revert for now. This reverts commit 70c067062217a5295ed321427b91cfd857c18b77. Reported by: jrtc27
* dtrace/arm64: Simplify dtrace_getarg() slightlyMark Johnston2025-01-291-3/+1
| | | | | | | | | The use of memcpy here is redundant, and also incorrect since memcpy() might be instrumented by fbt or kinst. dtrace_bcopy() exists, but we don't need it. MFC after: 2 weeks Sponsored by: Innovate UK
* dtrace/arm64: Simplify variable declarations in the invop handlerMark Johnston2025-01-221-6/+4
| | | | | | | | | Remove some unused variables and reduce the scope of some others. No functional change intended. MFC after: 1 week Sponsored by: Innovate UK
* dtrace: Add some more annotations for KMSANMark Johnston2024-11-231-10/+45
| | | | | | | | | | | | - Don't allow FBT and kinst to instrument the KMSAN runtime. - When fetching data from the traced thread's stack, mark it as initialized. It may well be uninitialized, but as dtrace permits arbitrary inspection of kernel memory, it isn't very useful to raise KMSAN reports. - Mark data copied in from userspace as initialized, as we do for copyin() etc. using interceptors. MFC after: 2 weeks
* dtrace: Avoid excessive pcpu allocationsMark Johnston2024-11-222-3/+3
| | | | | | | | | | | | | | | | We were previously allocating MAXCPU structures for several purposes, but this is generally unnecessary and is quite excessive, especially after MAXCPU was bumped to 1024 on amd64 and arm64. We already are careful to allocate only as many per-CPU tracing buffers as are needed; extend this to other allocations. For example, in a 2-vCPU VM, the size of a consumer state structure drops from 64KB to 128B. The size of the per-consumer `dts_buffer` and `dts_aggbuffer` arrays shrink similarly. Ditto for pre-allocations of local and global D variable storage space. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47667
* dtrace/amd64: Make invop providers usable with KMSAN enabledMark Johnston2024-11-222-0/+11
| | | | | | | | - Use a fresh context when entering dtrace_invop() via a breakpoint exception. - Mark the #BP trapframe as initialized. MFC after: 2 weeks
* dtrace: Address KMSAN warnings in dtrace_disx86Mark Johnston2024-11-221-2/+4
| | | | | | | wbit was not being initialized in a couple of cases. Reported by: asomers MFC after: 2 weeks
* dtrace/amd64: Remove the dtrace_invop_callsite symbolMark Johnston2024-09-191-4/+0
| | | | | | | | | It is not needed after commit 7e80fd5ef397. No functional change intended. Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46675
* dtrace tests: Add a test case which validates FBT probe argumentsMark Johnston2024-09-191-3/+25
| | | | | | Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46674
* dtrace_test: Remove the dependency on dtraceallMark Johnston2024-09-191-1/+0
| | | | | | | | | | | | | | FBT refuses to create probes in modules which depend on dtrace(all), but dtrace_test is a convenient place to add functions specifically for testing dtrace. The dependency on dtraceall is not needed, so just remove it. In fact, it can be useful to test SDT probe creation by loading dtrace_test with and without dtraceall loaded. Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46673
* dtrace/amd64: Fix probe argument fetchingMark Johnston2024-09-191-46/+31
| | | | | | | | | | | | | | | | | | dtrace_getarg() previously walked the call stack looking for a frame matching the dtrace_invop_callsite symbol, in order to look for a trapframe corresponding to an invop (i.e., FBT or kinst) probe. Commit 3ba8e9dc4a0e broke this in some cases by breaking the expected alignment of the dtrace_invop_callsite symbol. Rather than groveling around the stack to find invop probe arguments, simply use the trapframe reference saved by dtrace_invop(). This is simpler and less fragile. Reported by: avg Reviewed by: avg MFC after: 2 weeks Fixes: 3ba8e9dc4a0e ("dtrace/amd64: Implement emulation of call instructions") Differential Revision: https://reviews.freebsd.org/D46672
* dtrace: Avoid including dtrace_isa.c directly into dtrace.cMark Johnston2024-07-246-2/+11
| | | | | | | | | | | | | | This was done in the original DTrace import, presumably because that made it a bit easier to handle includes. However, this can cause dtrace_getpcstack() to be inlined into dtrace_probe(), resulting in a missing frame in stack traces since dtrace_getpcstack() takes care to bump "aframes" to account for its own stack frame. To avoid this, compile dtrace_isa.c separately on all platforms. Add requisite includes. MFC after: 2 weeks Sponsored by: Innovate UK
* dtrace: Add a partial implementation of dtrace_getarg() on arm64Mark Johnston2024-06-201-5/+28
| | | | | | | | | | | For invop providers (i.e., fbt and kinst) we can simply reach into the invop trapframe to fetch argument registers for arguments 0-7; for argument 8 and beyond we have to read the value off of the stack. Reviewed by: Domagoj Stolfa, avg MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45649
* sdt: Support fetching the probe sixth argument with MI machineryMark Johnston2024-06-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | SDT calls dtrace_probe() directly, and this can be used to pass up to five probe arguments directly. To pass the sixth argument (SDT currently doesn't support more than this), we use a hack: just add additional parameters to the call and cast dtrace_probe accordingly. This happens to work on amd64, but doesn't work in general. Modify SDT to call dtrace_probe() after storing arguments beyond the first five in thread-local storage. Implement sdt_getargval() to fetch extra argument values this way. An alternative would be to use invop handlers instead and make sdt_probe_func point to a breakpoint instruction, so that one can extract arguments using the breakpoint exception trapframe, but this makes the providers more expensive when enabled and doesn't seem justified. This approach works well unless we want to add more than one or two more parameters to SDT probes, which seems unlikely at present. In particular, this fixes fetching the last argument of most ip and tcp probes on arm64. Reported by: rwatson Reviewed by: Domagoj Stolfa MFC after: 1 month Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D45648
* sdt: Implement SDT probes using hot-patchingMark Johnston2024-06-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea here is to avoid a memory access and conditional branch per probe site. Instead, the probe is represented by an "unreachable" unconditional function call. asm goto is used to store the address of the probe site (represented by a no-op sled) and the address of the function call into a tracepoint record. Each SDT probe carries a list of tracepoints. When the probe is enabled, the no-op sled corresponding to each tracepoint is overwritten with a jmp to the corresponding label. The implementation uses smp_rendezvous() to park all other CPUs while the instruction is being overwritten, as this can't be done atomically in general. The compiler moves argument marshalling code and the sdt_probe() function call out-of-line, i.e., to the end of the function. Per gallatin@ in D43504, this approach has less overhead when probes are disabled. To make the implementation a bit simpler, I removed support for probes with 7 arguments; nothing makes use of this except a regression test case. It could be re-added later if need be. The approach taken in this patch enables some more improvements: 1. We can now automatically fill out the "function" field of SDT probe names. The SDT macros let the programmer specify the function and module names, but this is really a bug and shouldn't have been allowed. The intent was to be able to have the same probe in multiple functions and to let the user restrict which probes actually get enabled by specifying a function name or glob. 2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability to include blocks of code in the out-of-line path. For example: if (SDT_PROBES_ENABLED()) { int reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; SDT_PROBE1(proc, , , exit, reason); } could be written SDT_PROBE1_EXT(proc, , , exit, reason, int reason; reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; ); In the future I would like to use this mechanism more generally, e.g., to remove branches and marshalling code used by hwpmc, and generally to make it easier to add new tracepoint consumers without having to add more conditional branches to hot code paths. Reviewed by: Domagoj Stolfa, avg MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D44483
* dtrace: Remove LOCK_LEVELMark Johnston2024-06-191-2/+0
| | | | | | It is unused on FreeBSD. No functional change intended. MFC after: 1 week
* arm64: Support BTI checking in most of the kernelAndrew Turner2024-06-051-0/+3
| | | | | | | | | | | | | | | | | LLD has the -zbti-report=error argument to check if the BTI note is present when linking. To allow for this to be used when linking the kernel and modules: - Add the BTI note to the remaining assembly files - Mark ptrauth.c as protected by BTI - Disable -zbti-report for vmm hypervisor switching code as it's not used there. The linux64 module doesn't build with the flag as it includes vdso code that doesn't include the note. Reviewed by: imp, kib, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45466
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-272-5/+1
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sys: Remove ancient SCCS tags.Warner Losh2023-11-276-6/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* dtrace: remove x86 non-EARLY_AP_STARTUP supportEd Maste2023-10-102-56/+0
| | | | | | | | After 792655abd64c EARLY_AP_STARTUP is mandatory for x86. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42139
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-167-7/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1629-58/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* Revert "dtrace: cache current probe in kdtrace_thread_t"Christos Margiolis2023-07-191-2/+0
| | | | | | | | | | | This reverts commit 22508c8b6c284ad9ad1385c703e224e1ed3fbd7c. The t_kinst_curprobe field is no longer needed by kinst. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41031
* dtrace: cache current probe in kdtrace_thread_tChristos Margiolis2023-07-041-0/+2
| | | | | | | | | Needed by the forthcoming RISC-V and ARM64 ports. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40872
* dtrace/arm64: Fix user memory access routinesMark Johnston2023-06-151-7/+9
| | | | | | | | | | Use unprivileged loads to access user memory. Without this, the accesses trap and various dtrace actions such as ustack() fail. Reviewed by: andrew MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40540
* dtrace/arm64: Store the fault address when suppressing a page faultMark Johnston2023-06-151-1/+1
| | | | | | Reviewed by: andrew Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40539
* arm64: Remove struct arm64_frameMark Johnston2023-06-151-1/+1
| | | | | | | | | | | It was used in one place and was added specifically to support dtrace stack unwinding code. Write an equivalent expression using struct unwind_state instead. No functional change intended. Reviewed by: andrew MFC after: 1 week Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D40538
* kinst: rename t_kinst to t_kinst_trampChristos Margiolis2023-06-131-2/+2
| | | | | | | | | | | | | The forthcoming RISC-V and ARM64 ports of kinst introduce a new field named "t_kinst_curprobe", so "t_kinst" (which points to a trampoline) becomes a misleading name. No functional change intended. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40507
* dtrace: deduplicate some RISC-V functionsChristos Margiolis2023-05-302-17/+78
| | | | | | | | | | match_opcode() is defined in FBT, kinst, and dtrace_subr.c. The function prologue-checking functions are defined in FBT and kinst. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40335
* dtrace: rename rp to frame in dtrace_getreg()Christos Margiolis2023-05-236-71/+71
| | | | | | | Reviewed by: mhorne, markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40231
* dtrace: add register bindings for arm64Christos Margiolis2023-05-232-5/+48
| | | | | | | Reviewed by: mhorne, markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39956
* dtrace: implement dtrace_instr_size() for arm64Christos Margiolis2023-05-231-0/+14
| | | | | | | Reviewed by: markj Approved by; markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39955
* dtrace: export dtrace_dis_get_byte()Christos Margiolis2023-05-221-1/+2
| | | | | | | | | | | | kinst uses this function as well, but because it is not exported, it implements its own copy of it. The patch also exposes the function to userland, so programs that need to use dtrace_disx86() can use this function instead of rolling their own copies. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39871
* dtrace: Sync dis_tables.c with illumosMark Johnston2023-04-251-120/+1256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This brings in the following commits: commit 584b574a3b16c6772c8204ec1d1c957c56f22a87 12174 i86pc: variable may be used uninitialized Author: Toomas Soome <tsoome@me.com> Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Andrew Stormont <astormont@racktopsystems.com> Approved by: Dan McDonald <danmcd@joyent.com> commit a25e615d76804404e5fc63897a9196d4f92c3f5e 12371 dis x86 EVEX prefix mishandled 12372 dis EVEX encoding SIB mishandled 12373 dis support for EVEX vaes instructions 12374 dis support for EVEX vpclmulqdq instructions 12375 dis support for gfni instructions Author: Robert Mustacchi <rm@fingolfin.org> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Joshua M. Clulow <josh@sysmgr.org> commit c1e9bf00765d7ac9cf1986575e4489dd8710d9b1 12369 dis WBNOINVD support Author: Robert Mustacchi <rm@joyent.com> Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@joyent.com> commit e4f6ce7088a7dd335b9edf4774325f888692e5fb 10893 Need support for new Cascade Lake Instructions Author: Robert Mustacchi <rm@joyent.com> Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com> Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Gordon Ross <gwr@nexenta.com> commit cff040f3ef42d16ae655969398f5a5e6e700b85e 10226 Need support for new EPYC ISA extensions Author: Robert Mustacchi <rm@joyent.com> Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com> Reviewed by: Jason King <jason.king@joyent.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Dan McDonald <danmcd@joyent.com> commit d242cdf5288b86d9070d88791c8ee696612becdc 8492 AVX512 dis - legacy logical instructions Author: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Gordon Ross <gordon.w.ross@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net> commit 81b505b772ab015c588c56bb116239ee549b6eee 8384 AVX512 dis - EVEX prefix support 8385 32-bit avx dis test mishandles EVEX prefix 8386 32-bit bound dis is incorrect Author: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Gordon Ross <gordon.w.ross@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net> commit 92381362ae635a3bea638d87b7119f1623b6212e 8319 dis support for new xsave instructions Author: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Gordon Ross <gordon.w.ross@gmail.com> Approved by: Richard Lowe <richlowe@richlowe.net> commit a4e73d5d60e566669c550027fae2b1d87b4be2b4 8240 AVX512 dis - opmask instruction support Author: Jerry Jelinek <jerry.jelinek@joyent.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com> 959b2dfd39979fe8a9a315a52741d009eb168822 7825 want avx dis tests 7826 PCLMULQDQ psuedo-ops aren't properly described in dis 7827 dis tests for f16c, movbe, cpuid, msr, tsc, fence instrs 7828 sysenter and sysexit dis should be allowed in 64-bit x86 Author: Robert Mustacchi <rm@joyent.com> Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net> MFC after: 2 weeks
* dtrace: add register bindings for RISC-VChristos Margiolis2023-04-202-5/+62
| | | | | | | Reviewed by: mhorne, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39611
* dtrace: use dtrace_instr_size() in the riscv dtrace_subr.cChristos Margiolis2023-04-201-10/+3
| | | | | | | | | No functional change intended. Reviewed by: mhorne, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39652
* dtrace: expose dtrace_instr_size() to userland and implement it for riscvChristos Margiolis2023-04-201-0/+22
| | | | | | | | | | dtrace_instr_size() is needed by the forthcoming RISC-V port of kinst, as well as by libdtrace in D38825 for both amd64 and RISC-V. Reviewed by: markj, mhorne MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39489
* dtrace: get rid of uchar_t typesChristos Margiolis2023-04-203-10/+10
| | | | | | | | | | Callers are specifying uint8_t anyway and this slightly reduces dependencies on compatibility typedefs. No functional change intended. Reviewed by: markj, mhorne MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39490
* dtrace: handle NOP instructions in the riscv invop handlerChristos Margiolis2023-04-101-0/+3
| | | | | | | | | This will be used by a forthcoming port of the kinst provider. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39481
* dtrace/powerpc: Remove accidental commented out lineJustin Hibbits2023-03-131-1/+0
| | | | Fixes: 3e1155ade1b
* dtrace/powerpc: "Fix" stack traces across trap framesJustin Hibbits2023-03-111-6/+15
| | | | | | | | In function boundary tracing the link register is not yet saved to the save stack location, so the save point contains whatever the previous 'lr' save was, or even garbage, at the time the trap is taken. Address this by explicitly loading the link register from the trap frame instead of the stack, and propagate that out.
* dtrace: implement riscv dtrace_getustackdepth()Mitchell Horne2023-02-061-4/+27
| | | | | | | | | | Pretty trivial following other implementations. The existing dtrace_getustack_common() does most of the work. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38303
* dtrace: Fix RISC-V user stack unwinderJessica Clarke2023-02-061-3/+2
| | | | | | | | | | | | The unwind logic was copied from AArch64 which follows the peculiar AACPS (where, unlike typical RISC architectures, its frame pointer follows an x86/stack machine-like convention where the frame pointer points at the bottom of the frame record, not the top). Delete the pointless riscv_frame struct and fix this. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28054
* dtrace: handle page faults in riscv dtrace_trap()Mitchell Horne2023-02-061-5/+16
| | | | | | | | | | We must detect the correct amount to increment sepc, as it may have been a compressed instruction that triggered the fault. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38299
* dtrace_asm.S: properly enter/exit user accessMitchell Horne2023-02-061-1/+15
| | | | | | | | | | In order to read or write userspace memory without generating an access fault, we must first enable the SUM bit in the sstatus CSR. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38298