Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
45 lines
1.3 KiB
C
45 lines
1.3 KiB
C
/*
|
|
* Copyright (C) 2004 Fujitsu Siemens Computers GmbH
|
|
* Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#ifndef __FAULTINFO_I386_H
|
|
#define __FAULTINFO_I386_H
|
|
|
|
/* this structure contains the full arch-specific faultinfo
|
|
* from the traps.
|
|
* On i386, ptrace_faultinfo unfortunately doesn't provide
|
|
* all the info, since trap_no is missing.
|
|
* All common elements are defined at the same position in
|
|
* both structures, thus making it easy to copy the
|
|
* contents without knowledge about the structure elements.
|
|
*/
|
|
struct faultinfo {
|
|
int error_code; /* in ptrace_faultinfo misleadingly called is_write */
|
|
unsigned long cr2; /* in ptrace_faultinfo called addr */
|
|
int trap_no; /* missing in ptrace_faultinfo */
|
|
};
|
|
|
|
#define FAULT_WRITE(fi) ((fi).error_code & 2)
|
|
#define FAULT_ADDRESS(fi) ((fi).cr2)
|
|
|
|
/* This is Page Fault */
|
|
#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)
|
|
|
|
#define PTRACE_FULL_FAULTINFO 0
|
|
|
|
#define ___backtrack_faulted(_faulted) \
|
|
asm volatile ( \
|
|
"movl $__get_kernel_nofault_faulted_%=,%1\n" \
|
|
"mov $0, %0\n" \
|
|
"jmp _end_%=\n" \
|
|
"__get_kernel_nofault_faulted_%=:\n" \
|
|
"mov $1, %0;" \
|
|
"_end_%=:" \
|
|
: "=r" (_faulted), \
|
|
"=m" (current->thread.segv_continue) :: \
|
|
)
|
|
|
|
#endif
|