aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/grt/config/win32.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/grt/config/win32.c b/src/grt/config/win32.c
index c473b246c..677943c4a 100644
--- a/src/grt/config/win32.c
+++ b/src/grt/config/win32.c
@@ -164,18 +164,22 @@ int
__ghdl_run_through_longjump (int (*func)(void))
{
int res;
+
+#ifdef __i386__
+ /* Install an SEH handler. */
struct exception_registration er;
struct exception_registration *prev;
/* Get current handler. */
- asm ("mov %%fs:(0),%0" : "=r" (prev));
+ asm volatile ("mov %%fs:(0),%0" : "=r" (prev));
/* Build regisration. */
er.prev = prev;
er.handler = ghdl_SEH_handler;
/* Register. */
- asm ("mov %0,%%fs:(0)" : : "r" (&er));
+ asm volatile ("mov %0,%%fs:(0)" : : "r" (&er));
+#endif
run_env_en = 1;
res = setjmp (run_env);
@@ -183,8 +187,10 @@ __ghdl_run_through_longjump (int (*func)(void))
res = (*func)();
run_env_en = 0;
+#ifdef __i386__
/* Restore. */
- asm ("mov %0,%%fs:(0)" : : "r" (prev));
+ asm volatile ("mov %0,%%fs:(0)" : : "r" (prev));
+#endif
return res;
}