* include/excpt.h (__try1): Define based on _WIN64 definition.

(__except1): Ditto.
This commit is contained in:
Earnie Boyd 2012-08-01 16:46:01 +00:00
parent 764af9a4a5
commit 15d7cca236
2 changed files with 23 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2012-08-01 Earnie Boyd <earnie@users.sourceforge.net>
* include/excpt.h (__try1): Define based on _WIN64 definition.
(__except1): Ditto.
2012-07-30 Earnie Boyd <earnie@users.sourceforge.net> 2012-07-30 Earnie Boyd <earnie@users.sourceforge.net>
* include/stdint.h: Include _mingw.h for the definition of __int64 when * include/stdint.h: Include _mingw.h for the definition of __int64 when

View File

@ -75,8 +75,15 @@ typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
* onto the stack, then put a pointer to the new registration * onto the stack, then put a pointer to the new registration
* structure (i.e. the current stack pointer) at fs:0. * structure (i.e. the current stack pointer) at fs:0.
*/ */
#define __try1(pHandler) \ #ifdef _WIN64
__asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler)); # 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 * 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 * the stack must be in the exact state at this point that it was
* after we did __try1 or this will smash things. * after we did __try1 or this will smash things.
*/ */
#define __except1 \ #ifdef _WIN64
__asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \ # define __except1 \
: : : "%eax"); __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 #ifdef __cplusplus
} }