aboutsummaryrefslogtreecommitdiff
path: root/py/nlrx86.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-03-07 16:40:00 +0100
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-03-07 16:48:09 +0100
commitfd49ff991769a29b2dcc0f8ed88143487f2bd131 (patch)
tree6576a693586e1f027bc62d04ca9028185d5cdb5f /py/nlrx86.c
parent830ce74f324d3a384e383e840de4ee229c41ba36 (diff)
py/nlrx86: Add workaround for Zephyr.
Actually, this removes -fno-omit-frame-pointer workaround for Zephyr.
Diffstat (limited to 'py/nlrx86.c')
-rw-r--r--py/nlrx86.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/nlrx86.c b/py/nlrx86.c
index 4b178f46b..07ba72628 100644
--- a/py/nlrx86.c
+++ b/py/nlrx86.c
@@ -24,6 +24,7 @@
* THE SOFTWARE.
*/
+#include "py/mpconfig.h"
#include "py/mpstate.h"
#include "py/nlr.h"
@@ -46,7 +47,14 @@ unsigned int nlr_push(nlr_buf_t *nlr) {
(void)nlr;
__asm volatile (
+ // Check for Zephyr, which uses a different calling convention
+ // by default.
+ // TODO: Better check for Zephyr.
+ // TODE: Better support for various x86 calling conventions
+ // (unfortunately, __attribute__((naked)) is not supported on x86).
+ #ifndef CONFIG_SOC_IA32
"pop %ebp \n" // undo function's prelude
+ #endif
"mov 4(%esp), %edx \n" // load nlr_buf
"mov (%esp), %eax \n" // load return %eip
"mov %eax, 8(%edx) \n" // store %eip into nlr_buf