From 7dddd65b46085f70d3e60361087adfcefd45d062 Mon Sep 17 00:00:00 2001 From: Edmund Grimley Evans Date: Mon, 10 Oct 2016 20:15:57 +0100 Subject: [PATCH] In gen_vla_sp_restore, use X30 rather than get_reg. --- arm64-gen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arm64-gen.c b/arm64-gen.c index 82764511..f9f9581c 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -1826,7 +1826,10 @@ ST_FUNC void gen_vla_sp_save(int addr) { } ST_FUNC void gen_vla_sp_restore(int addr) { - uint32_t r = intr(get_reg(RC_INT)); + // Use x30 because this function can be called when there + // is a live return value in x0 but there is nothing on + // the value stack to prevent get_reg from returning x0. + uint32_t r = 30; arm64_ldrx(0, 3, r, 29, addr); o(0x9100001f | r << 5); // mov sp,x(r) }