Changeset 11892


Ignore:
Timestamp:
Apr 4, 2009, 8:04:58 PM (11 years ago)
Author:
gb
Message:

Define IS_PAGE_FAULT, which can be used to distinguish between page
faults (which provide more context info, like the fault address and
write-p flag) from x86 protection faults, which generally indicate
a failure at an earlier stage of address transation and don't provide
this information.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-exceptions.h

    r11888 r11892  
    170170#define SIGNUM_FOR_INTN_TRAP SIGSEGV
    171171#define IS_MAYBE_INT_TRAP(info,xp) ((xpGPR(xp,REG_TRAPNO)==0xd)&&((xpGPR(xp,REG_ERR)&7)==2))
     172#define IS_PAGE_FAULT(info,xp) (xpGPR(xp,REG_TRAPNO)==0xe)
    172173#define SIGRETURN(context)
    173174#endif
     
    177178#define SIGNUM_FOR_INTN_TRAP SIGBUS
    178179#define IS_MAYBE_INT_TRAP(info,xp) ((xp->uc_mcontext.mc_trapno == T_PROTFLT) && ((xp->uc_mcontext.mc_err & 7) == 2))
     180#define IS_PAGE_FAULT(info,xp) (xp->uc_mcontext.mc_trapno == T_PAGEFLT)
    179181#define SIGRETURN(context) freebsd_sigreturn(context)
    180182#endif
     
    182184#ifdef DARWIN
    183185#define SIGNUM_FOR_INTN_TRAP SIGSEGV /* Not really, but our Mach handler fakes that */
    184 #define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->es.trapno == 0xd) && (((UC_MCONTEXT(xp)->es.err)&7)==2))
     186#define IS_MAYBE_INT_TRAP(info,xp) ((UC_MCONTEXT(xp)->__es.trapno == 0xd) && (((UC_MCONTEXT(xp)->__es.err)&7)==2))
     187#define IS_PAGE_FAULT(info,xp) (UC_MCONTEXT(xp)->__es.trapno == 0xe)
    185188/* The x86 version of sigreturn just needs the context argument; the
    186189   hidden, magic "flavor" argument that sigtramp uses is ignored. */
     
    192195#ifdef X8664
    193196#define IS_MAYBE_INT_TRAP(info,xp) ((xpGPR(xp,REG_TRAPNO)==0xd)&&((xpGPR(xp,REG_ERR)&7)==2))
     197#define IS_MAYBE_INT_TRAP(info,xp) (xpGPR(xp,REG_TRAPNO)==0xe)
    194198#else
    195199#define IS_MAYBE_INT_TRAP(info,xp) ((xpGPR(xp,TRAPNO)==0xd)&&((xpGPR(xp,ERR)&7)==2))
     200#define IS_PAGE_FAULT(info,xp) (xpGPR(xp,TRAPNO)==0xe)
    196201#endif
    197202#define SIGRETURN(context) setcontext(context)
     
    204209   (info->ExceptionInformation[0]==0) &&                       \
    205210   (info->ExceptionInformation[1]==(ULONG_PTR)(-1L)))
     211#define IS_PAGE_FAULT(info,xp) (1)
    206212#define SIGRETURN(context)      /* for now */
    207213#endif
Note: See TracChangeset for help on using the changeset viewer.