diff --git a/sys/riscv/include/cpufunc.h b/sys/riscv/include/cpufunc.h index 6cac649b4e95..e411c6db09e9 100644 --- a/sys/riscv/include/cpufunc.h +++ b/sys/riscv/include/cpufunc.h @@ -37,10 +37,6 @@ #ifndef _MACHINE_CPUFUNC_H_ #define _MACHINE_CPUFUNC_H_ -#ifdef _KERNEL - -#include - static __inline void breakpoint(void) { @@ -48,6 +44,10 @@ breakpoint(void) __asm("ebreak"); } +#ifdef _KERNEL + +#include + static __inline register_t intr_disable(void) { diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 75785eff5033..a205f225fcf2 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); * Architectures with a user-visible breakpoint(). */ #if defined(__amd64__) || defined(__i386__) || defined(__mips__) || \ - defined(__sparc64__) + defined(__riscv) || defined(__sparc64__) #define HAVE_BREAKPOINT #endif @@ -67,6 +67,8 @@ __FBSDID("$FreeBSD$"); #define SKIP_BREAK(reg) #elif defined(__mips__) #define SKIP_BREAK(reg) ((reg)->r_regs[PC] += 4) +#elif defined(__riscv) +#define SKIP_BREAK(reg) ((reg)->sepc += 4) #elif defined(__sparc64__) #define SKIP_BREAK(reg) do { \ (reg)->r_tpc = (reg)->r_tnpc + 4; \