18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (C) 2004 Fujitsu Siemens Computers GmbH 38c2ecf20Sopenharmony_ci * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> 48c2ecf20Sopenharmony_ci * Licensed under the GPL 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __FAULTINFO_I386_H 88c2ecf20Sopenharmony_ci#define __FAULTINFO_I386_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* this structure contains the full arch-specific faultinfo 118c2ecf20Sopenharmony_ci * from the traps. 128c2ecf20Sopenharmony_ci * On i386, ptrace_faultinfo unfortunately doesn't provide 138c2ecf20Sopenharmony_ci * all the info, since trap_no is missing. 148c2ecf20Sopenharmony_ci * All common elements are defined at the same position in 158c2ecf20Sopenharmony_ci * both structures, thus making it easy to copy the 168c2ecf20Sopenharmony_ci * contents without knowledge about the structure elements. 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_cistruct faultinfo { 198c2ecf20Sopenharmony_ci int error_code; /* in ptrace_faultinfo misleadingly called is_write */ 208c2ecf20Sopenharmony_ci unsigned long cr2; /* in ptrace_faultinfo called addr */ 218c2ecf20Sopenharmony_ci int trap_no; /* missing in ptrace_faultinfo */ 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define FAULT_WRITE(fi) ((fi).error_code & 2) 258c2ecf20Sopenharmony_ci#define FAULT_ADDRESS(fi) ((fi).cr2) 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/* This is Page Fault */ 288c2ecf20Sopenharmony_ci#define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define PTRACE_FULL_FAULTINFO 0 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#endif 33