|
|
92319b |
diff --git a/sysdeps/linux-gnu/ppc/arch.h b/sysdeps/linux-gnu/ppc/arch.h
|
|
|
92319b |
index d5ad759..a8b67bb 100644
|
|
|
92319b |
--- a/sysdeps/linux-gnu/ppc/arch.h
|
|
|
92319b |
+++ b/sysdeps/linux-gnu/ppc/arch.h
|
|
|
92319b |
@@ -32,36 +32,45 @@
|
|
|
92319b |
#define LT_ELF_MACHINE EM_PPC
|
|
|
92319b |
|
|
|
92319b |
#ifdef __powerpc64__ // Says 'ltrace' is 64 bits, says nothing about target.
|
|
|
92319b |
-#define LT_ELFCLASS2 ELFCLASS64
|
|
|
92319b |
-#define LT_ELF_MACHINE2 EM_PPC64
|
|
|
92319b |
+# define LT_ELFCLASS2 ELFCLASS64
|
|
|
92319b |
+# define LT_ELF_MACHINE2 EM_PPC64
|
|
|
92319b |
|
|
|
92319b |
# ifdef __LITTLE_ENDIAN__
|
|
|
92319b |
-# define BREAKPOINT_VALUE { 0x08, 0x00, 0xe0, 0x7f }
|
|
|
92319b |
-# define ARCH_ENDIAN_LITTLE
|
|
|
92319b |
+# define BREAKPOINT_VALUE { 0x08, 0x00, 0xe0, 0x7f }
|
|
|
92319b |
+# define ARCH_ENDIAN_LITTLE
|
|
|
92319b |
# else
|
|
|
92319b |
-# define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
|
|
|
92319b |
-# define ARCH_SUPPORTS_OPD
|
|
|
92319b |
-# define ARCH_ENDIAN_BIG
|
|
|
92319b |
+# define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
|
|
|
92319b |
+# define ARCH_SUPPORTS_OPD
|
|
|
92319b |
+# define ARCH_ENDIAN_BIG
|
|
|
92319b |
# endif
|
|
|
92319b |
|
|
|
92319b |
-# if _CALL_ELF != 2
|
|
|
92319b |
-# define ARCH_SUPPORTS_OPD
|
|
|
92319b |
-# define STACK_FRAME_OVERHEAD 112
|
|
|
92319b |
+# if !defined(_CALL_ELF) || _CALL_ELF < 2
|
|
|
92319b |
+# define ARCH_SUPPORTS_OPD
|
|
|
92319b |
+# define STACK_FRAME_OVERHEAD 112
|
|
|
92319b |
# ifndef EF_PPC64_ABI
|
|
|
92319b |
-# define EF_PPC64_ABI 3
|
|
|
92319b |
+# define EF_PPC64_ABI 3
|
|
|
92319b |
# endif
|
|
|
92319b |
-# else /* _CALL_ELF == 2 ABIv2 */
|
|
|
92319b |
-# define STACK_FRAME_OVERHEAD 32
|
|
|
92319b |
+# elif _CALL_ELF == 2 /* ELFv2 ABI */
|
|
|
92319b |
+# define STACK_FRAME_OVERHEAD 32
|
|
|
92319b |
+# else
|
|
|
92319b |
+# error Unsupported PowerPC64 ABI.
|
|
|
92319b |
# endif /* CALL_ELF */
|
|
|
92319b |
|
|
|
92319b |
#else
|
|
|
92319b |
-#define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
|
|
|
92319b |
-#define ARCH_ENDIAN_BIG
|
|
|
92319b |
+# define STACK_FRAME_OVERHEAD 112
|
|
|
92319b |
+# define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
|
|
|
92319b |
+# define ARCH_ENDIAN_BIG
|
|
|
92319b |
# ifndef EF_PPC64_ABI
|
|
|
92319b |
-# define EF_PPC64_ABI 3
|
|
|
92319b |
+# define EF_PPC64_ABI 3
|
|
|
92319b |
# endif
|
|
|
92319b |
#endif /* __powerpc64__ */
|
|
|
92319b |
|
|
|
92319b |
+#ifdef _CALL_ELF
|
|
|
92319b |
+enum { ppc64_call_elf_abi = _CALL_ELF };
|
|
|
92319b |
+#else
|
|
|
92319b |
+enum { ppc64_call_elf_abi = 0 };
|
|
|
92319b |
+#endif
|
|
|
92319b |
+
|
|
|
92319b |
#define ARCH_HAVE_SW_SINGLESTEP
|
|
|
92319b |
#define ARCH_HAVE_ADD_PLT_ENTRY
|
|
|
92319b |
#define ARCH_HAVE_ADD_FUNC_ENTRY
|
|
|
92319b |
diff --git a/sysdeps/linux-gnu/ppc/fetch.c b/sysdeps/linux-gnu/ppc/fetch.c
|
|
|
92319b |
index c9381c3..c6cbd71 100644
|
|
|
92319b |
--- a/sysdeps/linux-gnu/ppc/fetch.c
|
|
|
92319b |
+++ b/sysdeps/linux-gnu/ppc/fetch.c
|
|
|
92319b |
@@ -1,6 +1,6 @@
|
|
|
92319b |
/*
|
|
|
92319b |
* This file is part of ltrace.
|
|
|
92319b |
- * Copyright (C) 2012 Petr Machata, Red Hat Inc.
|
|
|
92319b |
+ * Copyright (C) 2012, 2014 Petr Machata, Red Hat Inc.
|
|
|
92319b |
*
|
|
|
92319b |
* This program is free software; you can redistribute it and/or
|
|
|
92319b |
* modify it under the terms of the GNU General Public License as
|
|
|
92319b |
@@ -23,6 +23,7 @@
|
|
|
92319b |
#include <stdlib.h>
|
|
|
92319b |
#include <string.h>
|
|
|
92319b |
#include <sys/ucontext.h>
|
|
|
92319b |
+#include <stdio.h>
|
|
|
92319b |
|
|
|
92319b |
#include "backend.h"
|
|
|
92319b |
#include "fetch.h"
|
|
|
92319b |
@@ -57,7 +58,7 @@ struct fetch_context {
|
|
|
92319b |
arch_addr_t stack_pointer;
|
|
|
92319b |
int greg;
|
|
|
92319b |
int freg;
|
|
|
92319b |
- int ret_struct;
|
|
|
92319b |
+ bool ret_struct;
|
|
|
92319b |
|
|
|
92319b |
union {
|
|
|
92319b |
gregs32_t r32;
|
|
|
92319b |
@@ -65,11 +66,29 @@ struct fetch_context {
|
|
|
92319b |
} regs;
|
|
|
92319b |
struct fpregs_t fpregs;
|
|
|
92319b |
int vgreg;
|
|
|
92319b |
- int struct_size;
|
|
|
92319b |
- int struct_hfa_size;
|
|
|
92319b |
- int struct_hfa_count;
|
|
|
92319b |
};
|
|
|
92319b |
|
|
|
92319b |
+static bool
|
|
|
92319b |
+is_eligible_hfa(struct arg_type_info *info,
|
|
|
92319b |
+ struct arg_type_info **hfa_infop, size_t *hfa_countp)
|
|
|
92319b |
+{
|
|
|
92319b |
+ size_t hfa_count;
|
|
|
92319b |
+ struct arg_type_info *hfa_info = type_get_hfa_type(info, &hfa_count);
|
|
|
92319b |
+
|
|
|
92319b |
+ if (hfa_info != NULL && hfa_count <= 8
|
|
|
92319b |
+ && (hfa_info->type == ARGTYPE_FLOAT
|
|
|
92319b |
+ || hfa_info->type == ARGTYPE_DOUBLE)) {
|
|
|
92319b |
+
|
|
|
92319b |
+ if (hfa_infop != NULL)
|
|
|
92319b |
+ *hfa_infop = hfa_info;
|
|
|
92319b |
+ if (hfa_countp != NULL)
|
|
|
92319b |
+ *hfa_countp = hfa_count;
|
|
|
92319b |
+ return true;
|
|
|
92319b |
+ }
|
|
|
92319b |
+
|
|
|
92319b |
+ return false;
|
|
|
92319b |
+}
|
|
|
92319b |
+
|
|
|
92319b |
static int
|
|
|
92319b |
fetch_context_init(struct process *proc, struct fetch_context *context)
|
|
|
92319b |
{
|
|
|
92319b |
@@ -125,30 +144,37 @@ arch_fetch_arg_init(enum tof type, struct process *proc,
|
|
|
92319b |
}
|
|
|
92319b |
|
|
|
92319b |
context->vgreg = context->greg;
|
|
|
92319b |
- context->struct_size = 0;
|
|
|
92319b |
- context->struct_hfa_size = 0;
|
|
|
92319b |
- context->struct_hfa_count = 0;
|
|
|
92319b |
|
|
|
92319b |
/* Aggregates or unions of any length, and character strings
|
|
|
92319b |
* of length longer than 8 bytes, will be returned in a
|
|
|
92319b |
* storage buffer allocated by the caller. The caller will
|
|
|
92319b |
* pass the address of this buffer as a hidden first argument
|
|
|
92319b |
* in r3, causing the first explicit argument to be passed in
|
|
|
92319b |
- * r4. */
|
|
|
92319b |
- context->ret_struct = ret_info->type == ARGTYPE_STRUCT;
|
|
|
92319b |
- if (context->ret_struct) {
|
|
|
92319b |
-#if _CALL_ELF == 2
|
|
|
92319b |
- /* if R3 points to stack, parameters will be in R4. */
|
|
|
92319b |
- uint64_t pstack_end = ptrace(PTRACE_PEEKTEXT, proc->pid,
|
|
|
92319b |
- proc->stack_pointer, 0);
|
|
|
92319b |
- if (((arch_addr_t)context->regs.r64[3] > proc->stack_pointer)
|
|
|
92319b |
- && (context->regs.r64[3] < pstack_end)) {
|
|
|
92319b |
+ * r4.
|
|
|
92319b |
+ */
|
|
|
92319b |
+
|
|
|
92319b |
+ context->ret_struct = false;
|
|
|
92319b |
+
|
|
|
92319b |
+ if (ppc64_call_elf_abi == 2) {
|
|
|
92319b |
+ /* With ELFv2 ABI, aggregates that consist
|
|
|
92319b |
+ * (recursively) only of members of the same
|
|
|
92319b |
+ * floating-point or vector type, are passed in a
|
|
|
92319b |
+ * series of floating-point resp. vector registers.
|
|
|
92319b |
+ * Additionally, when returning any aggregate of up to
|
|
|
92319b |
+ * 16 bytes, general-purpose registers are used. */
|
|
|
92319b |
+
|
|
|
92319b |
+ if (ret_info->type == ARGTYPE_STRUCT
|
|
|
92319b |
+ && ! is_eligible_hfa(ret_info, NULL, NULL)
|
|
|
92319b |
+ && type_sizeof(proc, ret_info) > 16) {
|
|
|
92319b |
+
|
|
|
92319b |
+ context->ret_struct = true;
|
|
|
92319b |
context->greg++;
|
|
|
92319b |
context->stack_pointer += 8;
|
|
|
92319b |
}
|
|
|
92319b |
-#else
|
|
|
92319b |
+
|
|
|
92319b |
+ } else if (ret_info->type == ARGTYPE_STRUCT) {
|
|
|
92319b |
+ context->ret_struct = true;
|
|
|
92319b |
context->greg++;
|
|
|
92319b |
-#endif
|
|
|
92319b |
}
|
|
|
92319b |
|
|
|
92319b |
return context;
|
|
|
92319b |
@@ -176,17 +202,16 @@ allocate_stack_slot(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
|
|
|
92319b |
size_t a = type_alignof(proc, info);
|
|
|
92319b |
size_t off = 0;
|
|
|
92319b |
- if (proc->e_machine == EM_PPC && a < 4)
|
|
|
92319b |
- a = 4;
|
|
|
92319b |
-#if _CALL_ELF == 2
|
|
|
92319b |
- else if (proc->e_machine == EM_PPC64 && sz == 4 && is_hfa_type)
|
|
|
92319b |
+ if (proc->e_machine == EM_PPC && a < 4) {
|
|
|
92319b |
a = 4;
|
|
|
92319b |
- else
|
|
|
92319b |
- a = 8;
|
|
|
92319b |
-#else
|
|
|
92319b |
- else if (proc->e_machine == EM_PPC64 && a < 8)
|
|
|
92319b |
-#endif
|
|
|
92319b |
+ } else if (ppc64_call_elf_abi == 2) {
|
|
|
92319b |
+ if (proc->e_machine == EM_PPC64 && sz == 4 && is_hfa_type) {
|
|
|
92319b |
+ a = 4;
|
|
|
92319b |
+ } else
|
|
|
92319b |
+ a = 8;
|
|
|
92319b |
+ } else if (proc->e_machine == EM_PPC64 && a < 8) {
|
|
|
92319b |
a = 8;
|
|
|
92319b |
+ }
|
|
|
92319b |
|
|
|
92319b |
/* XXX Remove the two double casts when arch_addr_t
|
|
|
92319b |
* becomes integral type. */
|
|
|
92319b |
@@ -259,18 +284,19 @@ allocate_gpr(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
if (sz == (size_t)-1)
|
|
|
92319b |
return -1;
|
|
|
92319b |
assert(sz == 1 || sz == 2 || sz == 4 || sz == 8);
|
|
|
92319b |
-#if _CALL_ELF == 2
|
|
|
92319b |
- /* Consume the stack slot corresponding to this arg. */
|
|
|
92319b |
- if ((sz + off) >= 8)
|
|
|
92319b |
- ctx->greg++;
|
|
|
92319b |
|
|
|
92319b |
- if (is_hfa_type)
|
|
|
92319b |
- ctx->stack_pointer += sz;
|
|
|
92319b |
- else
|
|
|
92319b |
- ctx->stack_pointer += 8;
|
|
|
92319b |
-#else
|
|
|
92319b |
- ctx->greg++;
|
|
|
92319b |
-#endif
|
|
|
92319b |
+ if (ppc64_call_elf_abi == 2) {
|
|
|
92319b |
+ /* Consume the stack slot corresponding to this arg. */
|
|
|
92319b |
+ if ((sz + off) >= 8)
|
|
|
92319b |
+ ctx->greg++;
|
|
|
92319b |
+
|
|
|
92319b |
+ if (is_hfa_type)
|
|
|
92319b |
+ ctx->stack_pointer += sz;
|
|
|
92319b |
+ else
|
|
|
92319b |
+ ctx->stack_pointer += 8;
|
|
|
92319b |
+ } else {
|
|
|
92319b |
+ ctx->greg++;
|
|
|
92319b |
+ }
|
|
|
92319b |
|
|
|
92319b |
if (valuep == NULL)
|
|
|
92319b |
return 0;
|
|
|
92319b |
@@ -326,7 +352,6 @@ allocate_float(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
return allocate_stack_slot(ctx, proc, info, valuep, is_hfa_type);
|
|
|
92319b |
}
|
|
|
92319b |
|
|
|
92319b |
-#if _CALL_ELF == 2
|
|
|
92319b |
static int
|
|
|
92319b |
allocate_hfa(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
struct arg_type_info *info, struct value *valuep,
|
|
|
92319b |
@@ -336,27 +361,27 @@ allocate_hfa(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
if (sz == (size_t)-1)
|
|
|
92319b |
return -1;
|
|
|
92319b |
|
|
|
92319b |
- ctx->struct_hfa_size += sz;
|
|
|
92319b |
-
|
|
|
92319b |
/* There are two changes regarding structure return types:
|
|
|
92319b |
- * * heterogeneous float/vector structs are returned
|
|
|
92319b |
- * in (multiple) FP/vector registers,
|
|
|
92319b |
- * instead of via implicit reference.
|
|
|
92319b |
- * * small structs (up to 16 bytes) are return
|
|
|
92319b |
- * in one or two GPRs, instead of via implicit reference.
|
|
|
92319b |
+ * * heterogeneous float/vector structs are returned in
|
|
|
92319b |
+ * (multiple) FP/vector registers, instead of via implicit
|
|
|
92319b |
+ * reference.
|
|
|
92319b |
+ * * small structs (up to 16 bytes) are return in one or two
|
|
|
92319b |
+ * GPRs, instead of via implicit reference.
|
|
|
92319b |
*
|
|
|
92319b |
* Other structures (larger than 16 bytes, not heterogeneous)
|
|
|
92319b |
* are still returned via implicit reference (i.e. a pointer
|
|
|
92319b |
* to memory where to return the struct being passed in r3).
|
|
|
92319b |
- * Of course, whether or not an implicit reference pointer
|
|
|
92319b |
- * is present will shift the remaining arguments,
|
|
|
92319b |
- * so you need to get this right for ELFv2 in order
|
|
|
92319b |
- * to get the arguments correct.
|
|
|
92319b |
+ * Of course, whether or not an implicit reference pointer is
|
|
|
92319b |
+ * present will shift the remaining arguments, so you need to
|
|
|
92319b |
+ * get this right for ELFv2 in order to get the arguments
|
|
|
92319b |
+ * correct.
|
|
|
92319b |
+ *
|
|
|
92319b |
* If an actual parameter is known to correspond to an HFA
|
|
|
92319b |
* formal parameter, each element is passed in the next
|
|
|
92319b |
* available floating-point argument register starting at fp1
|
|
|
92319b |
* until the fp13. The remaining elements of the aggregate are
|
|
|
92319b |
- * passed on the stack. */
|
|
|
92319b |
+ * passed on the stack.
|
|
|
92319b |
+ */
|
|
|
92319b |
size_t slot_off = 0;
|
|
|
92319b |
|
|
|
92319b |
unsigned char *buf = value_reserve(valuep, sz);
|
|
|
92319b |
@@ -366,26 +391,17 @@ allocate_hfa(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
struct arg_type_info *hfa_info = type_get_simple(hfa_type);
|
|
|
92319b |
size_t hfa_sz = type_sizeof(proc, hfa_info);
|
|
|
92319b |
|
|
|
92319b |
- if (hfa_count > 8)
|
|
|
92319b |
- ctx->struct_hfa_count += hfa_count;
|
|
|
92319b |
-
|
|
|
92319b |
while (hfa_count > 0 && ctx->freg <= 13) {
|
|
|
92319b |
- int rc;
|
|
|
92319b |
struct value tmp;
|
|
|
92319b |
-
|
|
|
92319b |
value_init(&tmp, proc, NULL, hfa_info, 0);
|
|
|
92319b |
+ int rc = allocate_float(ctx, proc, hfa_info,
|
|
|
92319b |
+ &tmp, slot_off, true);
|
|
|
92319b |
+ if (rc == 0)
|
|
|
92319b |
+ memcpy(buf, value_get_data(&tmp, NULL), hfa_sz);
|
|
|
92319b |
+ value_destroy(&tmp);
|
|
|
92319b |
|
|
|
92319b |
- /* Hetereogeneous struct - get value on GPR or stack. */
|
|
|
92319b |
- if (((hfa_type == ARGTYPE_FLOAT
|
|
|
92319b |
- || hfa_type == ARGTYPE_DOUBLE)
|
|
|
92319b |
- && hfa_count <= 8))
|
|
|
92319b |
- rc = allocate_float(ctx, proc, hfa_info, &tmp,
|
|
|
92319b |
- slot_off, true);
|
|
|
92319b |
- else
|
|
|
92319b |
- rc = allocate_gpr(ctx, proc, hfa_info, &tmp,
|
|
|
92319b |
- slot_off, true);
|
|
|
92319b |
-
|
|
|
92319b |
- memcpy(buf, value_get_data(&tmp, NULL), hfa_sz);
|
|
|
92319b |
+ if (rc < 0)
|
|
|
92319b |
+ return -1;
|
|
|
92319b |
|
|
|
92319b |
slot_off += hfa_sz;
|
|
|
92319b |
buf += hfa_sz;
|
|
|
92319b |
@@ -394,17 +410,13 @@ allocate_hfa(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
slot_off = 0;
|
|
|
92319b |
ctx->vgreg++;
|
|
|
92319b |
}
|
|
|
92319b |
-
|
|
|
92319b |
- value_destroy(&tmp);
|
|
|
92319b |
- if (rc < 0)
|
|
|
92319b |
- return -1;
|
|
|
92319b |
}
|
|
|
92319b |
if (hfa_count == 0)
|
|
|
92319b |
return 0;
|
|
|
92319b |
|
|
|
92319b |
/* if no remaining FP, GPR corresponding to slot is used
|
|
|
92319b |
- * Mostly it is in part of r10. */
|
|
|
92319b |
- if (ctx->struct_hfa_size <= 64 && ctx->vgreg == 10) {
|
|
|
92319b |
+ * Mostly it is in part of r10. */
|
|
|
92319b |
+ if (ctx->vgreg == 10) {
|
|
|
92319b |
while (ctx->vgreg <= 10) {
|
|
|
92319b |
struct value tmp;
|
|
|
92319b |
value_init(&tmp, proc, NULL, hfa_info, 0);
|
|
|
92319b |
@@ -428,11 +440,8 @@ allocate_hfa(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
}
|
|
|
92319b |
}
|
|
|
92319b |
|
|
|
92319b |
- if (hfa_count == 0)
|
|
|
92319b |
- return 0;
|
|
|
92319b |
-
|
|
|
92319b |
/* Remaining values are on stack */
|
|
|
92319b |
- while (hfa_count) {
|
|
|
92319b |
+ while (hfa_count > 0) {
|
|
|
92319b |
struct value tmp;
|
|
|
92319b |
value_init(&tmp, proc, NULL, hfa_info, 0);
|
|
|
92319b |
|
|
|
92319b |
@@ -444,7 +453,6 @@ allocate_hfa(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
}
|
|
|
92319b |
return 0;
|
|
|
92319b |
}
|
|
|
92319b |
-#endif
|
|
|
92319b |
|
|
|
92319b |
static int
|
|
|
92319b |
allocate_argument(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
@@ -459,24 +467,20 @@ allocate_argument(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
case ARGTYPE_FLOAT:
|
|
|
92319b |
case ARGTYPE_DOUBLE:
|
|
|
92319b |
return allocate_float(ctx, proc, info, valuep,
|
|
|
92319b |
- 8 - type_sizeof(proc,info), false);
|
|
|
92319b |
+ 8 - type_sizeof(proc,info), false);
|
|
|
92319b |
|
|
|
92319b |
case ARGTYPE_STRUCT:
|
|
|
92319b |
if (proc->e_machine == EM_PPC) {
|
|
|
92319b |
if (value_pass_by_reference(valuep) < 0)
|
|
|
92319b |
return -1;
|
|
|
92319b |
- } else {
|
|
|
92319b |
-#if _CALL_ELF == 2
|
|
|
92319b |
+ } else if (ppc64_call_elf_abi == 2) {
|
|
|
92319b |
struct arg_type_info *hfa_info;
|
|
|
92319b |
- size_t hfa_size;
|
|
|
92319b |
- hfa_info = type_get_hfa_type(info, &hfa_size);
|
|
|
92319b |
- if (hfa_info != NULL ) {
|
|
|
92319b |
- size_t sz = type_sizeof(proc, info);
|
|
|
92319b |
- ctx->struct_size += sz;
|
|
|
92319b |
+ size_t hfa_count;
|
|
|
92319b |
+ if (is_eligible_hfa(info, &hfa_info, &hfa_count)) {
|
|
|
92319b |
return allocate_hfa(ctx, proc, info, valuep,
|
|
|
92319b |
- hfa_info->type, hfa_size);
|
|
|
92319b |
+ hfa_info->type, hfa_count);
|
|
|
92319b |
}
|
|
|
92319b |
-#endif
|
|
|
92319b |
+ } else {
|
|
|
92319b |
/* PPC64: Fixed size aggregates and unions passed by
|
|
|
92319b |
* value are mapped to as many doublewords of the
|
|
|
92319b |
* parameter save area as the value uses in memory.
|
|
|
92319b |
@@ -510,9 +514,6 @@ allocate_argument(struct fetch_context *ctx, struct process *proc,
|
|
|
92319b |
if (sz == (size_t)-1)
|
|
|
92319b |
return -1;
|
|
|
92319b |
|
|
|
92319b |
- if (ctx->ret_struct)
|
|
|
92319b |
- ctx->struct_size += sz;
|
|
|
92319b |
-
|
|
|
92319b |
size_t slots = (sz + width - 1) / width; /* Round up. */
|
|
|
92319b |
unsigned char *buf = value_reserve(valuep, slots * width);
|
|
|
92319b |
if (buf == NULL)
|
|
|
92319b |
@@ -605,19 +606,7 @@ arch_fetch_retval(struct fetch_context *ctx, enum tof type,
|
|
|
92319b |
if (fetch_context_init(proc, ctx) < 0)
|
|
|
92319b |
return -1;
|
|
|
92319b |
|
|
|
92319b |
-#if _CALL_ELF == 2
|
|
|
92319b |
- void *ptr = (void *)(ctx->regs.r64[1]+32);
|
|
|
92319b |
- uint64_t val = ptrace(PTRACE_PEEKTEXT, proc->pid, ptr, 0);
|
|
|
92319b |
-
|
|
|
92319b |
- if (ctx->ret_struct
|
|
|
92319b |
- && ((ctx->struct_size > 64
|
|
|
92319b |
- || ctx->struct_hfa_count > 8
|
|
|
92319b |
- || (ctx->struct_hfa_size == 0 && ctx->struct_size > 56)
|
|
|
92319b |
- || (ctx->regs.r64[3] == ctx->regs.r64[1]+32)
|
|
|
92319b |
- || (ctx->regs.r64[3] == val )))) {
|
|
|
92319b |
-#else
|
|
|
92319b |
if (ctx->ret_struct) {
|
|
|
92319b |
-#endif
|
|
|
92319b |
assert(info->type == ARGTYPE_STRUCT);
|
|
|
92319b |
|
|
|
92319b |
uint64_t addr = read_gpr(ctx, proc, 3);
|