summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-03 23:51:16 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-03 23:51:16 +0100
commit4b34c76fd6040bb0332923165fcfaf8c85b5dac6 (patch)
tree7d1998fa4f06ace67814df913acbe6e49a7c813a /py
parent3996611c1bb70af23bfe33809900fe5ee6fa0a3f (diff)
downloadmicropython-4b34c76fd6040bb0332923165fcfaf8c85b5dac6.tar.gz
micropython-4b34c76fd6040bb0332923165fcfaf8c85b5dac6.zip
Changes to get unix/ port compiling on Cygwin.
Diffstat (limited to 'py')
-rw-r--r--py/nlr.h4
-rw-r--r--py/nlrx64.S63
2 files changed, 66 insertions, 1 deletions
diff --git a/py/nlr.h b/py/nlr.h
index 4cc66d8c20..b94ca7d3f8 100644
--- a/py/nlr.h
+++ b/py/nlr.h
@@ -11,7 +11,11 @@ struct _nlr_buf_t {
#if defined(__i386__)
void *regs[6];
#elif defined(__x86_64__)
+ #if defined(__CYGWIN__)
+ void *regs[12];
+ #else
void *regs[8];
+ #endif
#elif defined(__thumb2__)
void *regs[10];
#else
diff --git a/py/nlrx64.S b/py/nlrx64.S
index c5711001e6..a4073981a5 100644
--- a/py/nlrx64.S
+++ b/py/nlrx64.S
@@ -4,6 +4,8 @@
.file "nlr.s"
.text
+#if !defined(__CYGWIN__)
+
/* uint nlr_push(rdi=nlr_buf_t *nlr) */
#if !(defined(__APPLE__) && defined(__MACH__))
.globl nlr_push
@@ -82,4 +84,63 @@ nlr_jump:
.local nlr_top
#endif
.comm nlr_top,8,8
-#endif
+
+#else // !defined(__CYGWIN__)
+
+/* uint nlr_push(rcx=nlr_buf_t *nlr) */
+ .globl nlr_push
+nlr_push:
+ movq (%rsp), %rax # load return %rip
+ movq %rax, 16(%rcx) # store %rip into nlr_buf
+ movq %rbp, 24(%rcx) # store %rbp into nlr_buf
+ movq %rsp, 32(%rcx) # store %rsp into nlr_buf
+ movq %rbx, 40(%rcx) # store %rbx into nlr_buf
+ movq %r12, 48(%rcx) # store %r12 into nlr_buf
+ movq %r13, 56(%rcx) # store %r13 into nlr_buf
+ movq %r14, 64(%rcx) # store %r14 into nlr_buf
+ movq %r15, 72(%rcx) # store %r15 into
+ movq %rdi, 80(%rcx) # store %rdr into
+ movq %rsi, 88(%rcx) # store %rsi into
+ movq nlr_top(%rip), %rax # get last nlr_buf
+ movq %rax, (%rcx) # store it
+ movq %rcx, nlr_top(%rip) # stor new nlr_buf (to make linked list)
+ xorq %rax, %rax # return 0, normal return
+ ret # return
+
+/* void nlr_jump(rcx=uint val) */
+
+ .globl nlr_jump
+nlr_jump:
+ movq %rcx, %rax # put return value in %rax
+ movq nlr_top(%rip), %rcx # get nlr_top into %rsi
+ movq %rax, 8(%rcx) # store return value
+ movq (%rcx), %rax # load prev nlr_buf
+ movq %rax, nlr_top(%rip) # store prev nlr_buf (to unlink list)
+ movq 72(%rcx), %r15 # load saved %r15
+ movq 64(%rcx), %r14 # load saved %r14
+ movq 56(%rcx), %r13 # load saved %r13
+ movq 48(%rcx), %r12 # load saved %r12
+ movq 40(%rcx), %rbx # load saved %rbx
+ movq 32(%rcx), %rsp # load saved %rsp
+ movq 24(%rcx), %rbp # load saved %rbp
+ movq 16(%rcx), %rax # load saved %rip
+ movq 80(%rcx), %rdi # store %rdr into
+ movq 88(%rcx), %rsi # store %rsi into
+ movq %rax, (%rsp) # store saved %rip to stack
+ xorq %rax, %rax # clear return register
+ inc %al # increase to make 1, non-local return
+ ret # return
+
+ .comm nlr_top,8,8
+
+ /* void nlr_pop() */
+ .globl nlr_pop
+nlr_pop:
+ movq nlr_top(%rip), %rax # get nlr_top into %rax
+ movq (%rax), %rax # load prev nlr_buf
+ movq %rax, nlr_top(%rip) # store prev nlr_buf (to unlink list)
+ ret # return
+
+#endif // !defined(__CYGWIN__)
+
+#endif // __x86_64__