--- zzzz-none-000/linux-5.15.111/arch/x86/kernel/ptrace.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/arch/x86/kernel/ptrace.c 2024-02-07 10:22:35.000000000 +0000 @@ -1,4 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-only + +/* + * Includes Intel Corporation's changes/modifications dated: 2017. + * Changed/modified portions - Copyright (c) 2017, Intel Corporation. + */ + /* By Ross Biro 1/23/92 */ /* * Pentium III FXSR, SSE support @@ -449,6 +455,8 @@ return ret; } +#ifdef CONFIG_HW_BREAKPOINTS + static void ptrace_triggered(struct perf_event *bp, struct perf_sample_data *data, struct pt_regs *regs) @@ -667,6 +675,34 @@ return rc; } +#else + +/* Without breakpoints only handle DR6 */ +static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n) +{ + struct thread_struct *thread = &tsk->thread; + + if (n == 6) + return thread->virtual_dr6; + return 0; +} + +/* Without breakpoints only handle DR6 */ +static int ptrace_set_debugreg(struct task_struct *tsk, int n, + unsigned long val) +{ + struct thread_struct *thread = &tsk->thread; + int rc = -EIO; + + if (n == 6) { + thread->virtual_dr6 = val; + rc = 0; + } + return rc; +} + +#endif + /* * These access the current or another (stopped) task's io permission * bitmap for debugging or core dump.