diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-07 17:05:08 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-08 22:36:02 +1100 |
commit | 52b6764894755324db036731ae1d6ec77172419a (patch) | |
tree | ebc46de84eda7929919e2de374453e4f7112dba2 /py/nlrx64.c | |
parent | a64a0276b353cf13043d6892ac74d50c251719aa (diff) |
py/nlrx64: Fixes to support Mac OS.
Two independent fixes:
- need to prefix symbols referenced from asm with underscore;
- need to undo the C-function prelude.
Diffstat (limited to 'py/nlrx64.c')
-rw-r--r-- | py/nlrx64.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/nlrx64.c b/py/nlrx64.c index 845aac67a..c23fd8fc6 100644 --- a/py/nlrx64.c +++ b/py/nlrx64.c @@ -61,6 +61,9 @@ unsigned int nlr_push(nlr_buf_t *nlr) { #else __asm volatile ( + #if defined(__APPLE__) || defined(__MACH__) + "pop %rbp \n" // undo function's prelude + #endif "movq (%rsp), %rax \n" // load return %rip "movq %rax, 16(%rdi) \n" // store %rip into nlr_buf "movq %rbp, 24(%rdi) \n" // store %rbp into nlr_buf @@ -70,7 +73,11 @@ unsigned int nlr_push(nlr_buf_t *nlr) { "movq %r13, 56(%rdi) \n" // store %r13 into nlr_buf "movq %r14, 64(%rdi) \n" // store %r14 into nlr_buf "movq %r15, 72(%rdi) \n" // store %r15 into nlr_buf + #if defined(__APPLE__) || defined(__MACH__) + "jmp _nlr_push_tail \n" // do the rest in C + #else "jmp nlr_push_tail \n" // do the rest in C + #endif ); #endif |