162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright (C) 2004 Fujitsu Siemens Computers GmbH 362306a36Sopenharmony_ci * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> 462306a36Sopenharmony_ci * Licensed under the GPL 562306a36Sopenharmony_ci */ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#ifndef __FAULTINFO_I386_H 862306a36Sopenharmony_ci#define __FAULTINFO_I386_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* this structure contains the full arch-specific faultinfo 1162306a36Sopenharmony_ci * from the traps. 1262306a36Sopenharmony_ci * On i386, ptrace_faultinfo unfortunately doesn't provide 1362306a36Sopenharmony_ci * all the info, since trap_no is missing. 1462306a36Sopenharmony_ci * All common elements are defined at the same position in 1562306a36Sopenharmony_ci * both structures, thus making it easy to copy the 1662306a36Sopenharmony_ci * contents without knowledge about the structure elements. 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_cistruct faultinfo { 1962306a36Sopenharmony_ci int error_code; /* in ptrace_faultinfo misleadingly called is_write */ 2062306a36Sopenharmony_ci unsigned long cr2; /* in ptrace_faultinfo called addr */ 2162306a36Sopenharmony_ci int trap_no; /* missing in ptrace_faultinfo */ 2262306a36Sopenharmony_ci}; 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define FAULT_WRITE(fi) ((fi).error_code & 2) 2562306a36Sopenharmony_ci#define FAULT_ADDRESS(fi) ((fi).cr2) 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci/* This is Page Fault */ 2862306a36Sopenharmony_ci#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#define PTRACE_FULL_FAULTINFO 0 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci#endif 33