* [RFA] Fix varargs calls for PowerPC System V ABI
@ 2005-06-19 10:31 Mark Kettenis
2005-08-12 16:30 ` [ping] " Mark Kettenis
2005-08-15 23:05 ` Kevin Buettner
0 siblings, 2 replies; 3+ messages in thread
From: Mark Kettenis @ 2005-06-19 10:31 UTC (permalink / raw)
To: gdb-patches; +Cc: keveinb, cagney
The patch below fixes
FAIL: gdb.base/varargs.exp: print find_max_double(5,1.0,17.0,2.0,3.0,4.0)
on my OpenBSD/macppc system. Rather than having a (possibly) fragile
check for vararg-ness, it always sets the bit in the condition
register. Normal functions shouldn't care for it, and indeed the way
we did these calls in the past, the condition register might be set to
anything.
OK?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Set condition
register appropriately for varargs functions.
Index: ppc-sysv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-sysv-tdep.c,v
retrieving revision 1.29
diff -u -p -r1.29 ppc-sysv-tdep.c
--- ppc-sysv-tdep.c 25 May 2005 03:12:13 -0000 1.29
+++ ppc-sysv-tdep.c 19 Jun 2005 10:24:55 -0000
@@ -295,6 +295,24 @@ ppc_sysv_abi_push_dummy_call (struct gdb
/* Ensure that the stack is still 16 byte aligned. */
sp = align_down (sp, 16);
}
+
+ /* The psABI says that "A caller of a function that takes a
+ variable argument list shall set condition register bit 6 to
+ 1 if it passes one or more arguments in the floating-point
+ registers. It is strongly recommended that the caller set the
+ bit to 0 otherwise..." Doing this for normal functions too
+ shouldn't hurt. */
+ if (write_pass)
+ {
+ ULONGEST cr;
+
+ regcache_cooked_read_unsigned (regcache, tdep->ppc_cr_regnum, &cr);
+ if (freg > 1)
+ cr |= 0x02000000;
+ else
+ cr &= ~0x02000000;
+ regcache_cooked_write_unsigned (regcache, tdep->ppc_cr_regnum, cr);
+ }
}
/* Update %sp. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ping] [RFA] Fix varargs calls for PowerPC System V ABI
2005-06-19 10:31 [RFA] Fix varargs calls for PowerPC System V ABI Mark Kettenis
@ 2005-08-12 16:30 ` Mark Kettenis
2005-08-15 23:05 ` Kevin Buettner
1 sibling, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2005-08-12 16:30 UTC (permalink / raw)
To: gdb-patches; +Cc: kevinb, cagney
Sent this one about two months ago. Kevin is excused since I
misspelled his mail address ;-).
------- Start of forwarded message -------
Date: Sun, 19 Jun 2005 12:30:55 +0200 (CEST)
From: Mark Kettenis <kettenis@elgar.sibelius.xs4all.nl>
To: gdb-patches@sources.redhat.com
CC: kevinb@redhat.com, cagney@gnu.org
Subject: [ping] [RFA] Fix varargs calls for PowerPC System V ABI
The patch below fixes
FAIL: gdb.base/varargs.exp: print find_max_double(5,1.0,17.0,2.0,3.0,4.0)
on my OpenBSD/macppc system. Rather than having a (possibly) fragile
check for vararg-ness, it always sets the bit in the condition
register. Normal functions shouldn't care for it, and indeed the way
we did these calls in the past, the condition register might be set to
anything.
OK?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Set condition
register appropriately for varargs functions.
Index: ppc-sysv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-sysv-tdep.c,v
retrieving revision 1.29
diff -u -p -r1.29 ppc-sysv-tdep.c
--- ppc-sysv-tdep.c 25 May 2005 03:12:13 -0000 1.29
+++ ppc-sysv-tdep.c 19 Jun 2005 10:24:55 -0000
@@ -295,6 +295,24 @@ ppc_sysv_abi_push_dummy_call (struct gdb
/* Ensure that the stack is still 16 byte aligned. */
sp = align_down (sp, 16);
}
+
+ /* The psABI says that "A caller of a function that takes a
+ variable argument list shall set condition register bit 6 to
+ 1 if it passes one or more arguments in the floating-point
+ registers. It is strongly recommended that the caller set the
+ bit to 0 otherwise..." Doing this for normal functions too
+ shouldn't hurt. */
+ if (write_pass)
+ {
+ ULONGEST cr;
+
+ regcache_cooked_read_unsigned (regcache, tdep->ppc_cr_regnum, &cr);
+ if (freg > 1)
+ cr |= 0x02000000;
+ else
+ cr &= ~0x02000000;
+ regcache_cooked_write_unsigned (regcache, tdep->ppc_cr_regnum, cr);
+ }
}
/* Update %sp. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ping] [RFA] Fix varargs calls for PowerPC System V ABI
2005-06-19 10:31 [RFA] Fix varargs calls for PowerPC System V ABI Mark Kettenis
2005-08-12 16:30 ` [ping] " Mark Kettenis
@ 2005-08-15 23:05 ` Kevin Buettner
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Buettner @ 2005-08-15 23:05 UTC (permalink / raw)
To: gdb-patches
On Sun, 19 Jun 2005 12:30:55 +0200 (CEST)
Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
> * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Set condition
> register appropriately for varargs functions.
Okay. (Sorry for the late response.)
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-15 22:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-19 10:31 [RFA] Fix varargs calls for PowerPC System V ABI Mark Kettenis
2005-08-12 16:30 ` [ping] " Mark Kettenis
2005-08-15 23:05 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox