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