From: Jim Wilson <jimw@sifive.com>
To: gdb-patches@sourceware.org
Cc: Jim Wilson <jimw@sifive.com>
Subject: [PATCH 1/3] RISC-V: gdb.base/gnu_vector fixes.
Date: Tue, 06 Nov 2018 21:44:00 -0000 [thread overview]
Message-ID: <20181106214403.22192-1-jimw@sifive.com> (raw)
In-Reply-To: <CAFyWVaYMo6sOfXQqZ3YuRyjSnsfGSB9vZTO43j6hKRva73_TCA@mail.gmail.com>
Ensure that stack slots are always the same size as XLEN by rounding up arg
sizes when computing the address of the next stack slot.
gdb/
* riscv-tdep.c (riscv_assign_stack_location): New arg slot_align.
Use with align_up when setting arg_offset.
(riscv_call_arg_scalar_int): Call riscv_assign_stack_location with
cinfo->xlen as new arg.
---
gdb/riscv-tdep.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index db372e2163..ac4f2533f4 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -1868,13 +1868,13 @@ riscv_assign_reg_location (struct riscv_arg_info::location *loc,
static void
riscv_assign_stack_location (struct riscv_arg_info::location *loc,
struct riscv_memory_offsets *memory,
- int length, int align)
+ int length, int align, int slot_align)
{
loc->loc_type = riscv_arg_info::location::on_stack;
memory->arg_offset
= align_up (memory->arg_offset, align);
loc->loc_data.offset = memory->arg_offset;
- memory->arg_offset += length;
+ memory->arg_offset += align_up (length, slot_align);
loc->c_length = length;
/* Offset is always 0, either we're the first location part, in which
@@ -1919,7 +1919,7 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
cinfo->xlen, 0))
riscv_assign_stack_location (&ainfo->argloc[1],
&cinfo->memory, cinfo->xlen,
- cinfo->xlen);
+ cinfo->xlen, cinfo->xlen);
}
else
{
@@ -1928,7 +1928,8 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
if (!riscv_assign_reg_location (&ainfo->argloc[0],
&cinfo->int_regs, len, 0))
riscv_assign_stack_location (&ainfo->argloc[0],
- &cinfo->memory, len, ainfo->align);
+ &cinfo->memory, len, ainfo->align,
+ cinfo->xlen);
if (len < ainfo->length)
{
@@ -1937,7 +1938,8 @@ riscv_call_arg_scalar_int (struct riscv_arg_info *ainfo,
&cinfo->int_regs, len,
cinfo->xlen))
riscv_assign_stack_location (&ainfo->argloc[1],
- &cinfo->memory, len, cinfo->xlen);
+ &cinfo->memory, len, cinfo->xlen,
+ cinfo->xlen);
}
}
}
--
2.17.1
next prev parent reply other threads:[~2018-11-06 21:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-06 21:43 [PATCH 0/3] " Jim Wilson
2018-11-06 21:44 ` Jim Wilson [this message]
2018-11-08 15:43 ` [PATCH 1/3] " Andrew Burgess
2018-11-13 1:52 ` Jim Wilson
2018-11-06 21:44 ` [PATCH 3/3] " Jim Wilson
2018-11-08 14:34 ` Andrew Burgess
2018-11-08 14:44 ` Andrew Burgess
2018-11-06 21:44 ` [PATCH 2/3] " Jim Wilson
2018-11-08 14:37 ` Andrew Burgess
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181106214403.22192-1-jimw@sifive.com \
--to=jimw@sifive.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox