aboutsummaryrefslogtreecommitdiff
path: root/py/nlrx86.c
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2017-12-26 10:52:09 +0100
committerDamien George <damien.p.george@gmail.com>2017-12-29 22:24:46 +1100
commitb184b6ae5334b87472897d0034a7388acafe41cc (patch)
treee7e7aaa67cccc1d5f7e9f9a6a7f632f0d3a92b25 /py/nlrx86.c
parent8041de59fed09e3185aaf01bb2faf1f733747dc8 (diff)
py/nlr: Fix nlr functions for 64bit ports built with gcc on Windows
The number of registers used should be 10, not 12, to match the assembly code in nlrx64.c. With this change the 64bit mingw builds don't need to use the setjmp implementation, and this fixes miscellaneous crashes and assertion failures as reported in #1751 for instance. To avoid mistakes in the future where something gcc-related for Windows only gets fixed for one particular compiler/environment combination, make use of a MICROPY_NLR_OS_WINDOWS macro. To make sure everything nlr-related is now ok when built with gcc this has been verified with: - unix port built with gcc on Cygwin (i686-pc-cygwin-gcc and x86_64-pc-cygwin-gcc, version 6.4.0) - windows port built with mingw-w64's gcc from Cygwin (i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc, version 6.4.0) and MSYS2 (like the ones on Cygwin but version 7.2.0)
Diffstat (limited to 'py/nlrx86.c')
-rw-r--r--py/nlrx86.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/py/nlrx86.c b/py/nlrx86.c
index 9490c4f42..23882cc30 100644
--- a/py/nlrx86.c
+++ b/py/nlrx86.c
@@ -33,13 +33,7 @@
// For reference, x86 callee save regs are:
// ebx, esi, edi, ebp, esp, eip
-#if defined(_WIN32) || defined(__CYGWIN__)
-#define NLR_OS_WINDOWS 1
-#else
-#define NLR_OS_WINDOWS 0
-#endif
-
-#if NLR_OS_WINDOWS
+#if MICROPY_NLR_OS_WINDOWS
unsigned int nlr_push_tail(nlr_buf_t *nlr) asm("nlr_push_tail");
#else
__attribute__((used)) unsigned int nlr_push_tail(nlr_buf_t *nlr);