ocaml/0011-aarch64-Fix-for-mantis-6507.patch

82 lines
3.0 KiB
Diff
Raw Normal View History

From a887f2e04859d288908ddf7c8835108cdcd1be6b Mon Sep 17 00:00:00 2001
From: Mark Shinwell <mshinwell@janestreet.com>
Date: Fri, 8 Aug 2014 14:38:12 +0100
Subject: [PATCH 11/11] aarch64: Fix for mantis 6507.
http://caml.inria.fr/mantis/view.php?id=6507
---
asmrun/arm64.S | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/asmrun/arm64.S b/asmrun/arm64.S
index 50abdae..0dcb3a8 100644
--- a/asmrun/arm64.S
+++ b/asmrun/arm64.S
@@ -83,10 +83,10 @@ caml_call_gc:
PROFILE
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
-.Lcaml_call_gc:
/* Record lowest stack address */
mov TMP, sp
STOREGLOBAL(TMP, caml_bottom_of_stack)
+.Lcaml_call_gc:
/* Set up stack space, saving return address and frame pointer */
/* (2 regs RA/GP, 24 allocatable int regs, 24 caller-save float regs) * 8 */
stp x29, x30, [sp, -400]!
@@ -175,7 +175,14 @@ caml_alloc1:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
- add x29, sp, #0
+ /* Record the lowest address of the caller's stack frame. This is the address
+ immediately above the pair of words (x29 and x30) we just pushed. Those must
+ not be included since otherwise the distance from [caml_bottom_of_stack] to the
+ highest address in the caller's stack frame won't match the frame size contained
+ in the relevant frame descriptor. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
+ sub x29, x29, #16
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
/* Call GC */
@@ -200,7 +207,10 @@ caml_alloc2:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
- add x29, sp, #0
+ /* Record the lowest address of the caller's stack frame. See comment above. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
+ sub x29, x29, #16
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
/* Call GC */
@@ -225,7 +235,10 @@ caml_alloc3:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
- add x29, sp, #0
+ /* Record the lowest address of the caller's stack frame. See comment above. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
+ sub x29, x29, #16
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
/* Call GC */
@@ -250,7 +263,10 @@ caml_allocN:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
- add x29, sp, #0
+ /* Record the lowest address of the caller's stack frame. See comment above. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
+ sub x29, x29, #16
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
/* Call GC. This preserves ARG */
--
1.9.3