ref: c33620540f35a1e64e0a60ee885520cfde9e8471
parent: 9ac1c506c10ebe2a7ce8eb51e30c36c533565572
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Aug 28 13:18:03 EDT 2016
Our ABI relies on zero %rbp to terminate the stack. Let's zero it.
--- a/rt/_myrrt-plan9.s
+++ b/rt/_myrrt-plan9.s
@@ -57,6 +57,7 @@
PUSHQ R13
PUSHQ DX
+ XORQ BP,BP
CALL __init__(SB)
CALL main(SB)
POPQ DX
--- a/rt/start-freebsd.s
+++ b/rt/start-freebsd.s
@@ -53,6 +53,7 @@
pushq %rsi
pushq %rdx
+ xorq %rbp,%rbp
/* call pre-main initializers */
call __init__
--- a/rt/start-linux.s
+++ b/rt/start-linux.s
@@ -66,6 +66,7 @@
pushq %rsi
pushq %rdx
+ xorq %rbp,%rbp
/* call pre-main initializers */
call __init__
/* enter the main program */
--- a/rt/start-openbsd.s
+++ b/rt/start-openbsd.s
@@ -75,6 +75,7 @@
pushq %rsi
pushq %rdx
+ xorq %rbp,%rbp
/* call pre-main initializers */
call __init__
/* enter the main program */
--- a/rt/start-osx.s
+++ b/rt/start-osx.s
@@ -54,6 +54,7 @@
pushq %rsi
pushq %rdx
+ xorq %rbp,%rbp
call ___init__
/* enter the main program */
call _main