summaryrefslogtreecommitdiffstats
path: root/tcg/sparc/tcg-target.c.inc
diff options
context:
space:
mode:
authorRichard Henderson2021-06-19 01:49:26 +0200
committerRichard Henderson2021-06-19 20:09:10 +0200
commit9defd1bdfb0f2ddb3ca9863e39577f3a9929d58c (patch)
tree1d59ca926984cb76a24ee79a3a0d37ff7ff81ec9 /tcg/sparc/tcg-target.c.inc
parentaccel/tcg: Probe the proper permissions for atomic ops (diff)
downloadqemu-9defd1bdfb0f2ddb3ca9863e39577f3a9929d58c.tar.gz
qemu-9defd1bdfb0f2ddb3ca9863e39577f3a9929d58c.tar.xz
qemu-9defd1bdfb0f2ddb3ca9863e39577f3a9929d58c.zip
tcg/sparc: Fix temp_allocate_frame vs sparc stack bias
We should not be aligning the offset in temp_allocate_frame, because the odd offset produces an aligned address in the end. Instead, pass the logical offset into tcg_set_frame and add the stack bias last. Cc: qemu-stable@nongnu.org Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg/sparc/tcg-target.c.inc')
-rw-r--r--tcg/sparc/tcg-target.c.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc
index ce39ac2d86..a6ec94a094 100644
--- a/tcg/sparc/tcg-target.c.inc
+++ b/tcg/sparc/tcg-target.c.inc
@@ -984,14 +984,18 @@ static void tcg_target_qemu_prologue(TCGContext *s)
{
int tmp_buf_size, frame_size;
- /* The TCG temp buffer is at the top of the frame, immediately
- below the frame pointer. */
+ /*
+ * The TCG temp buffer is at the top of the frame, immediately
+ * below the frame pointer. Use the logical (aligned) offset here;
+ * the stack bias is applied in temp_allocate_frame().
+ */
tmp_buf_size = CPU_TEMP_BUF_NLONGS * (int)sizeof(long);
- tcg_set_frame(s, TCG_REG_I6, TCG_TARGET_STACK_BIAS - tmp_buf_size,
- tmp_buf_size);
+ tcg_set_frame(s, TCG_REG_I6, -tmp_buf_size, tmp_buf_size);
- /* TCG_TARGET_CALL_STACK_OFFSET includes the stack bias, but is
- otherwise the minimal frame usable by callees. */
+ /*
+ * TCG_TARGET_CALL_STACK_OFFSET includes the stack bias, but is
+ * otherwise the minimal frame usable by callees.
+ */
frame_size = TCG_TARGET_CALL_STACK_OFFSET - TCG_TARGET_STACK_BIAS;
frame_size += TCG_STATIC_CALL_ARGS_SIZE + tmp_buf_size;
frame_size += TCG_TARGET_STACK_ALIGN - 1;