Path: blob/master/arch/x86/um/shared/sysdep/faultinfo_32.h
26516 views
/*1* Copyright (C) 2004 Fujitsu Siemens Computers GmbH2* Author: Bodo Stroesser <[email protected]>3* Licensed under the GPL4*/56#ifndef __FAULTINFO_I386_H7#define __FAULTINFO_I386_H89/* this structure contains the full arch-specific faultinfo10* from the traps.11* On i386, ptrace_faultinfo unfortunately doesn't provide12* all the info, since trap_no is missing.13* All common elements are defined at the same position in14* both structures, thus making it easy to copy the15* contents without knowledge about the structure elements.16*/17struct faultinfo {18int error_code; /* in ptrace_faultinfo misleadingly called is_write */19unsigned long cr2; /* in ptrace_faultinfo called addr */20int trap_no; /* missing in ptrace_faultinfo */21};2223#define FAULT_WRITE(fi) ((fi).error_code & 2)24#define FAULT_ADDRESS(fi) ((fi).cr2)2526/* This is Page Fault */27#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14)2829#define PTRACE_FULL_FAULTINFO 03031#define ___backtrack_faulted(_faulted) \32asm volatile ( \33"movl $__get_kernel_nofault_faulted_%=,%1\n" \34"mov $0, %0\n" \35"jmp _end_%=\n" \36"__get_kernel_nofault_faulted_%=:\n" \37"mov $1, %0;" \38"_end_%=:" \39: "=r" (_faulted), \40"=m" (current->thread.segv_continue) :: \41)4243#endif444546