From 15d7cca2369603f4b6874c88f4244f9c19c56b66 Mon Sep 17 00:00:00 2001 From: Earnie Boyd Date: Wed, 1 Aug 2012 16:46:01 +0000 Subject: [PATCH] * include/excpt.h (__try1): Define based on _WIN64 definition. (__except1): Ditto. --- winsup/mingw/ChangeLog | 5 +++++ winsup/mingw/include/excpt.h | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index edf023911..b0f749390 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2012-08-01 Earnie Boyd + + * include/excpt.h (__try1): Define based on _WIN64 definition. + (__except1): Ditto. + 2012-07-30 Earnie Boyd * include/stdint.h: Include _mingw.h for the definition of __int64 when diff --git a/winsup/mingw/include/excpt.h b/winsup/mingw/include/excpt.h index e75ceb78f..3919cb791 100644 --- a/winsup/mingw/include/excpt.h +++ b/winsup/mingw/include/excpt.h @@ -75,8 +75,15 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; * onto the stack, then put a pointer to the new registration * structure (i.e. the current stack pointer) at fs:0. */ -#define __try1(pHandler) \ - __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); +#ifdef _WIN64 +# define __try1(pHandler) \ + __asm__ __volatile__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : \ + "g" (pHandler)); +#else +# define __try1(pHandler) \ + __asm__ __volatile__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : \ + "g" (pHandler)); +#endif /* * A macro which (despite its name) *removes* an installed @@ -89,9 +96,15 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD; * the stack must be in the exact state at this point that it was * after we did __try1 or this will smash things. */ -#define __except1 \ - __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ - : : : "%eax"); +#ifdef _WIN64 +# define __except1 \ + __asm__ __volatile__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq \ + $16,%%rsp;" : : : "%rax"); +#else +# define __except1 \ + __asm__ __volatile__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl \ + $8,%%esp;" : : : "%eax"); +#endif #ifdef __cplusplus }