From: Taylor R Campbell Date: Thu, 22 Jul 2010 20:23:04 +0000 (+0000) Subject: Exploit common mcontext structure shared between NetBSD ports. X-Git-Tag: 20101212-Gtk~139 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=8cee2f106e7a8d43afc8706c0ab225aa8a546d8c;p=mit-scheme.git Exploit common mcontext structure shared between NetBSD ports. --- diff --git a/src/microcode/uxtrap.h b/src/microcode/uxtrap.h index 05cc4fb8d..c6fe50dbc 100644 --- a/src/microcode/uxtrap.h +++ b/src/microcode/uxtrap.h @@ -646,22 +646,31 @@ typedef struct #if defined(__NetBSD_Version__) && __NetBSD_Version__ >= 200000000 # define HAVE_SIGACTION_SIGINFO_SIGNALS -# define HAVE_SIGCONTEXT # include # include +# include # ifdef __IA32__ -# include -# define SIGCONTEXT_NREGS _NGREG -# define __SIGCONTEXT_REG(scp, ir) \ - ((((scp) -> uc_mcontext) . __gregs) [(ir)]) -# define SIGCONTEXT_FIRST_REG(scp) (& (__SIGCONTEXT_REG (scp, _REG_GS))) -# define SIGCONTEXT_RFREE(scp) (__SIGCONTEXT_REG (scp, _REG_EDI)) +# define SIGCONTEXT_RFREE(scp) ((SIGCONTEXT_FIRST_REG (scp)) [_REG_EDI]) +# define HAVE_NETBSD_GENERIC_MCONTEXT +# endif + +# ifdef __x86_64__ +# define SIGCONTEXT_RFREE(scp) ((SIGCONTEXT_FIRST_REG (scp)) [_REG_RDI]) +# define HAVE_NETBSD_GENERIC_MCONTEXT # endif -# define SIGCONTEXT_SP(scp) (_UC_MACHINE_SP (scp)) -# define SIGCONTEXT_PC(scp) (_UC_MACHINE_PC (scp)) +/* When I checked, on 2010-07-22, the only NetBSD ports without the + generic mcontext interface were IA-64 and usermode. */ + +# ifdef HAVE_NETBSD_GENERIC_MCONTEXT +# define HAVE_SIGCONTEXT +# define SIGCONTEXT_NREGS _NGREG +# define SIGCONTEXT_FIRST_REG(scp) (((scp) -> uc_mcontext) . __gregs) +# define SIGCONTEXT_SP(scp) (_UC_MACHINE_SP (scp)) +# define SIGCONTEXT_PC(scp) (_UC_MACHINE_PC (scp)) +# endif # define INITIALIZE_UX_SIGNAL_CODES() \ do { \