Export a breakpoint() function to userland for arm and arm64.
Enable ptrace() tests using breakpoint() on these architectures. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D15191
This commit is contained in:
parent
7900bb1666
commit
a9c91abd3b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336053
@ -54,7 +54,7 @@
|
||||
static __inline void
|
||||
breakpoint(void)
|
||||
{
|
||||
__asm(".word 0xe7ffffff");
|
||||
__asm("udf 0xffff");
|
||||
}
|
||||
|
||||
struct cpu_functions {
|
||||
@ -495,6 +495,19 @@ extern u_int arm_cache_level;
|
||||
extern u_int arm_cache_loc;
|
||||
extern u_int arm_cache_type[14];
|
||||
|
||||
#else /* !_KERNEL */
|
||||
|
||||
static __inline void
|
||||
breakpoint(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* This matches the instruction used by GDB for software
|
||||
* breakpoints.
|
||||
*/
|
||||
__asm("udf 0xfdee");
|
||||
}
|
||||
|
||||
#endif /* _KERNEL */
|
||||
#endif /* _MACHINE_CPUFUNC_H_ */
|
||||
|
||||
|
@ -29,12 +29,6 @@
|
||||
#ifndef _MACHINE_CPUFUNC_H_
|
||||
#define _MACHINE_CPUFUNC_H_
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <machine/armreg.h>
|
||||
|
||||
void pan_enable(void);
|
||||
|
||||
static __inline void
|
||||
breakpoint(void)
|
||||
{
|
||||
@ -42,6 +36,12 @@ breakpoint(void)
|
||||
__asm("brk #0");
|
||||
}
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#include <machine/armreg.h>
|
||||
|
||||
void pan_enable(void);
|
||||
|
||||
static __inline register_t
|
||||
dbg_disable(void)
|
||||
{
|
||||
|
@ -54,8 +54,9 @@ __FBSDID("$FreeBSD$");
|
||||
/*
|
||||
* Architectures with a user-visible breakpoint().
|
||||
*/
|
||||
#if defined(__amd64__) || defined(__i386__) || defined(__mips__) || \
|
||||
defined(__riscv) || defined(__sparc64__)
|
||||
#if defined(__aarch64__) || defined(__amd64__) || defined(__arm__) || \
|
||||
defined(__i386__) || defined(__mips__) || defined(__riscv) || \
|
||||
defined(__sparc64__)
|
||||
#define HAVE_BREAKPOINT
|
||||
#endif
|
||||
|
||||
@ -63,8 +64,12 @@ __FBSDID("$FreeBSD$");
|
||||
* Adjust PC to skip over a breakpoint when stopped for a breakpoint trap.
|
||||
*/
|
||||
#ifdef HAVE_BREAKPOINT
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
#if defined(__aarch64__)
|
||||
#define SKIP_BREAK(reg) ((reg)->elr += 4)
|
||||
#elif defined(__amd64__) || defined(__i386__)
|
||||
#define SKIP_BREAK(reg)
|
||||
#elif defined(__arm__)
|
||||
#define SKIP_BREAK(reg) ((reg)->r_pc += 4)
|
||||
#elif defined(__mips__)
|
||||
#define SKIP_BREAK(reg) ((reg)->r_regs[PC] += 4)
|
||||
#elif defined(__riscv)
|
||||
|
Loading…
Reference in New Issue
Block a user