Skip to content

Commit fd49ff9

Browse files
committed
py/nlrx86: Add workaround for Zephyr.
Actually, this removes -fno-omit-frame-pointer workaround for Zephyr.
1 parent 830ce74 commit fd49ff9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

py/nlrx86.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* THE SOFTWARE.
2525
*/
2626

27+
#include "py/mpconfig.h"
2728
#include "py/mpstate.h"
2829
#include "py/nlr.h"
2930

@@ -46,7 +47,14 @@ unsigned int nlr_push(nlr_buf_t *nlr) {
4647
(void)nlr;
4748

4849
__asm volatile (
50+
// Check for Zephyr, which uses a different calling convention
51+
// by default.
52+
// TODO: Better check for Zephyr.
53+
// TODE: Better support for various x86 calling conventions
54+
// (unfortunately, __attribute__((naked)) is not supported on x86).
55+
#ifndef CONFIG_SOC_IA32
4956
"pop %ebp \n" // undo function's prelude
57+
#endif
5058
"mov 4(%esp), %edx \n" // load nlr_buf
5159
"mov (%esp), %eax \n" // load return %eip
5260
"mov %eax, 8(%edx) \n" // store %eip into nlr_buf

0 commit comments

Comments
 (0)