aboutsummaryrefslogtreecommitdiff
path: root/gdb/s390-tdep.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-09-19 16:22:39 +0000
committerAndrew Cagney <cagney@redhat.com>2003-09-19 16:22:39 +0000
commit5b03f2662bf6d0e139ee4fbd089723a2e1b3deee (patch)
tree63386ca80e67a51370f3a6dc04673d74b8e27e13 /gdb/s390-tdep.c
parent9f6c1c4b8b74fd670fc2af651dd5df989e109779 (diff)
downloadgdb-5b03f2662bf6d0e139ee4fbd089723a2e1b3deee.zip
gdb-5b03f2662bf6d0e139ee4fbd089723a2e1b3deee.tar.gz
gdb-5b03f2662bf6d0e139ee4fbd089723a2e1b3deee.tar.bz2
2003-09-19 Andrew Cagney <cagney@redhat.com>
* utils.c (align_up, align_down): New functions. * defs.h (align_up, align_down): Declare. * ppc-sysv-tdep.c (align_up, align_down): Delete functions. * s390-tdep.c: Replace "round_up" and "round_down" with "align_up" and "align_down". (round_up, round_down): Delete functions. * mips-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and "align_down". (ROUND_DOWN, ROUND_UP): Delete macros. (mips_dump_tdep): Do not print "ROUND_UP" or "ROUND_DOWN". * h8300-tdep.c: Replace "round_up" and "round_down" with "align_up" and "align_down". (round_up, round_down): Delete macros. * frv-tdep.c: Replace ROUND_UP and ROUND_DOWN with "align_up" and "align_down". (ROUND_UP, ROUND_DOWN): Delete macros.
Diffstat (limited to 'gdb/s390-tdep.c')
-rw-r--r--gdb/s390-tdep.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index ee6574d..e4921eb 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -2206,28 +2206,6 @@ extend_simple_arg (struct value *arg)
}
-/* Round ADDR up to the next N-byte boundary. N must be a power of
- two. */
-static CORE_ADDR
-round_up (CORE_ADDR addr, int n)
-{
- /* Check that N is really a power of two. */
- gdb_assert (n && (n & (n-1)) == 0);
- return ((addr + n - 1) & -n);
-}
-
-
-/* Round ADDR down to the next N-byte boundary. N must be a power of
- two. */
-static CORE_ADDR
-round_down (CORE_ADDR addr, int n)
-{
- /* Check that N is really a power of two. */
- gdb_assert (n && (n & (n-1)) == 0);
- return (addr & -n);
-}
-
-
/* Return the alignment required by TYPE. */
static int
alignment_of (struct type *type)
@@ -2304,7 +2282,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
&& pass_by_copy_ref (type))
{
sp -= length;
- sp = round_down (sp, alignment_of (type));
+ sp = align_down (sp, alignment_of (type));
write_memory (sp, VALUE_CONTENTS (arg), length);
copy_addr[i] = sp;
num_copies++;
@@ -2323,7 +2301,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
struct type *type = VALUE_TYPE (arg);
int length = TYPE_LENGTH (type);
- sp = round_down (sp, alignment_of (type));
+ sp = align_down (sp, alignment_of (type));
/* SIMPLE_ARG values get extended to DEPRECATED_REGISTER_SIZE bytes.
Assume every argument is. */
@@ -2333,12 +2311,12 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
}
/* Include space for any reference-to-copy pointers. */
- sp = round_down (sp, pointer_size);
+ sp = align_down (sp, pointer_size);
sp -= num_copies * pointer_size;
/* After all that, make sure it's still aligned on an eight-byte
boundary. */
- sp = round_down (sp, 8);
+ sp = align_down (sp, 8);
/* Finally, place the actual parameters, working from SP towards
higher addresses. The code above is supposed to reserve enough
@@ -2403,7 +2381,7 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
{
/* Simple args are always extended to
DEPRECATED_REGISTER_SIZE bytes. */
- starg = round_up (starg, DEPRECATED_REGISTER_SIZE);
+ starg = align_up (starg, DEPRECATED_REGISTER_SIZE);
/* Do we need to pass a pointer to our copy of this
argument? */
@@ -2420,10 +2398,10 @@ s390_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
else
{
/* You'd think we should say:
- starg = round_up (starg, alignment_of (type));
+ starg = align_up (starg, alignment_of (type));
Unfortunately, GCC seems to simply align the stack on
a four/eight-byte boundary, even when passing doubles. */
- starg = round_up (starg, S390_STACK_PARAMETER_ALIGNMENT);
+ starg = align_up (starg, S390_STACK_PARAMETER_ALIGNMENT);
write_memory (starg, VALUE_CONTENTS (arg), length);
starg += length;
}