summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Shinwell <mshinwell@janestreet.com>2014-08-08 22:17:56 +0000
committerMark Shinwell <mshinwell@janestreet.com>2014-08-08 22:17:56 +0000
commite17e2b19daa21433882bdf32c626a91d27fffb85 (patch)
treec24ef70dae1fa6abd84ed800a63c6a1b97b3ad92
parentc8940948e0f4e941f44658ab3b62dfcde60b6b7e (diff)
downloadocaml-e17e2b19daa21433882bdf32c626a91d27fffb85.tar.gz
PR#6507: [caml_bottom_of_stack] incorrectly set
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15076 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--Changes2
-rw-r--r--asmrun/arm64.S18
2 files changed, 19 insertions, 1 deletions
diff --git a/Changes b/Changes
index 7c1994c3f8..09dcb99dca 100644
--- a/Changes
+++ b/Changes
@@ -152,6 +152,8 @@ OCamldoc:
(Maxence Guesdon, report by Anil Madhavapeddy)
Bug fixes:
+- PR#6507: crash on AArch64 resulting from incorrect setting of
+ [caml_bottom_of_stack]. (Richard Jones, Mark Shinwell)
- PR#2719: wrong scheduling of bound checks within a
try...with Invalid_argument -> _ ... (Xavier Leroy)
- PR#4719: Sys.executable_name wrong if executable name contains dots (Windows)
diff --git a/asmrun/arm64.S b/asmrun/arm64.S
index fa871df797..9b4b9ab7c9 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,6 +175,13 @@ caml_alloc1:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
+ /* 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)
add x29, sp, #0
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
@@ -200,6 +207,9 @@ caml_alloc2:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
+ /* Record the lowest address of the caller's stack frame. See comment above. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
add x29, sp, #0
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
@@ -225,6 +235,9 @@ caml_alloc3:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
+ /* Record the lowest address of the caller's stack frame. See comment above. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
add x29, sp, #0
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)
@@ -250,6 +263,9 @@ caml_allocN:
ret
2: stp x29, x30, [sp, -16]!
CFI_ADJUST(16)
+ /* Record the lowest address of the caller's stack frame. See comment above. */
+ add x29, sp, #16
+ STOREGLOBAL(x29, caml_bottom_of_stack)
add x29, sp, #0
/* Record return address */
STOREGLOBAL(x30, caml_last_return_address)