aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2012-05-30 13:26:16 -0400
committerPetr Machata <pmachata@redhat.com>2012-08-29 19:03:18 +0200
commit0b926f68098c4dd0df922ba2c6214ed902cd4cd6 (patch)
tree8deea85033ef9374fbb406d501f4cd5d9a39b98c /sysdeps
parent8d30fd9f26ccd15f0fa27e09d1fd99deddb17d36 (diff)
downloadltrace-0b926f68098c4dd0df922ba2c6214ed902cd4cd6.tar.gz
In s390 fetch backend, compute type size in advance, pass in argument list
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/linux-gnu/s390/fetch.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/sysdeps/linux-gnu/s390/fetch.c b/sysdeps/linux-gnu/s390/fetch.c
index fc58efd..911a60d 100644
--- a/sysdeps/linux-gnu/s390/fetch.c
+++ b/sysdeps/linux-gnu/s390/fetch.c
@@ -146,16 +146,13 @@ arch_fetch_arg_clone(struct Process *proc,
static int
allocate_stack_slot(struct fetch_context *ctx, struct Process *proc,
- struct arg_type_info *info, struct value *valuep)
+ struct arg_type_info *info, struct value *valuep,
+ size_t sz)
{
/* Note: when here, we shouldn't see composite types, those
* are passed by reference, which is handled below. Here we
* only deal with integers, floats, etc. */
- size_t sz = type_sizeof(proc, info);
- if (sz == (size_t)-1)
- return -1;
-
size_t a;
if (s390x(ctx)) {
assert(sz <= 8);
@@ -183,10 +180,11 @@ copy_gpr(struct fetch_context *ctx, struct value *valuep, int regno)
static int
allocate_gpr(struct fetch_context *ctx, struct Process *proc,
- struct arg_type_info *info, struct value *valuep)
+ struct arg_type_info *info, struct value *valuep,
+ size_t sz)
{
if (ctx->greg > 6)
- return allocate_stack_slot(ctx, proc, info, valuep);
+ return allocate_stack_slot(ctx, proc, info, valuep, sz);
copy_gpr(ctx, valuep, ctx->greg++);
return 0;
@@ -194,17 +192,13 @@ allocate_gpr(struct fetch_context *ctx, struct Process *proc,
static int
allocate_fpr(struct fetch_context *ctx, struct Process *proc,
- struct arg_type_info *info, struct value *valuep)
+ struct arg_type_info *info, struct value *valuep,
+ size_t sz)
{
-
int pool = s390x(ctx) ? 6 : 2;
if (ctx->freg > pool)
- return allocate_stack_slot(ctx, proc, info, valuep);
-
- size_t sz = type_sizeof(proc, info);
- if (sz == (size_t)-1)
- return -1;
+ return allocate_stack_slot(ctx, proc, info, valuep, sz);
if (value_reserve(valuep, sz) == NULL)
return -1;
@@ -221,6 +215,10 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
struct Process *proc,
struct arg_type_info *info, struct value *valuep)
{
+ size_t sz = type_sizeof(proc, info);
+ if (sz == (size_t)-1)
+ return -1;
+
/* XXX structures<4 bytes on s390 and structures<8 bytes on
* s390x are passed in register. On s390, long long and
* structures<8 bytes are passed in two consecutive
@@ -237,10 +235,10 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
case ARGTYPE_FLOAT:
case ARGTYPE_DOUBLE:
- return allocate_fpr(ctx, proc, info, valuep);
+ return allocate_fpr(ctx, proc, info, valuep, sz);
if (type_sizeof(proc, info) < 8)
- return allocate_gpr(ctx, proc, info,valuep);
+ return allocate_gpr(ctx, proc, info, valuep, sz);
/* fall through */
case ARGTYPE_ARRAY:
@@ -256,7 +254,7 @@ arch_fetch_arg_next(struct fetch_context *ctx, enum tof type,
case ARGTYPE_SHORT:
case ARGTYPE_USHORT:
case ARGTYPE_POINTER:
- return allocate_gpr(ctx, proc, info, valuep);
+ return allocate_gpr(ctx, proc, info, valuep, sz);
}
return -1;
}