summaryrefslogtreecommitdiff
path: root/05/tcc-0.9.27/lib/alloca86_64-bt.S
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-02-18 12:36:57 -0500
committerpommicket <pommicket@gmail.com>2022-02-18 12:36:57 -0500
commit826d1afd58c2e064a9c8fdb09eda1b08469de1a8 (patch)
treeb4fedc589a1944f6cf3f451a9db976b431e89b25 /05/tcc-0.9.27/lib/alloca86_64-bt.S
parentc42c5d94b8944e19cd17a5b540e4c70013c62b92 (diff)
newer version of tcc almost working
Diffstat (limited to '05/tcc-0.9.27/lib/alloca86_64-bt.S')
-rw-r--r--05/tcc-0.9.27/lib/alloca86_64-bt.S56
1 files changed, 56 insertions, 0 deletions
diff --git a/05/tcc-0.9.27/lib/alloca86_64-bt.S b/05/tcc-0.9.27/lib/alloca86_64-bt.S
new file mode 100644
index 0000000..4cbad90
--- /dev/null
+++ b/05/tcc-0.9.27/lib/alloca86_64-bt.S
@@ -0,0 +1,56 @@
+/* ---------------------------------------------- */
+/* alloca86_64.S */
+
+.globl __bound_alloca
+__bound_alloca:
+
+#ifdef _WIN32
+ # bound checking is not implemented
+ pop %rdx
+ mov %rcx,%rax
+ add $15,%rax
+ and $-16,%rax
+ jz p3
+
+p1:
+ cmp $4096,%rax
+ jbe p2
+ test %rax,-4096(%rsp)
+ sub $4096,%rsp
+ sub $4096,%rax
+ jmp p1
+p2:
+
+ sub %rax,%rsp
+ mov %rsp,%rax
+ add $32,%rax
+
+p3:
+ push %rdx
+ ret
+#else
+ pop %rdx
+ mov %rdi,%rax
+ mov %rax,%rsi # size, a second parm to the __bound_new_region
+
+ add $15,%rax
+ and $-16,%rax
+ jz p3
+
+
+ sub %rax,%rsp
+ mov %rsp,%rdi # pointer, a first parm to the __bound_new_region
+ mov %rsp,%rax
+
+ push %rdx
+ push %rax
+ call __bound_new_region
+ pop %rax
+ pop %rdx
+
+p3:
+ push %rdx
+ ret
+#endif
+
+/* ---------------------------------------------- */