From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 664 invoked by alias); 19 Jun 2005 10:31:34 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 635 invoked by uid 22791); 19 Jun 2005 10:31:31 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sun, 19 Jun 2005 10:31:31 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j5JAV0E9023318; Sun, 19 Jun 2005 12:31:00 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id j5JAV0AC003254; Sun, 19 Jun 2005 12:31:00 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id j5JAUtRE023985; Sun, 19 Jun 2005 12:30:55 +0200 (CEST) Date: Sun, 19 Jun 2005 10:31:00 -0000 Message-Id: <200506191030.j5JAUtRE023985@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: gdb-patches@sources.redhat.com CC: keveinb@redhat.com, cagney@gnu.org Subject: [RFA] Fix varargs calls for PowerPC System V ABI X-SW-Source: 2005-06/txt/msg00292.txt.bz2 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 * 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. */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7312 invoked by alias); 12 Aug 2005 12:05:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6564 invoked by uid 22791); 12 Aug 2005 12:05:00 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 12 Aug 2005 12:05:00 +0000 Received: from sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j7CC4f3p017431; Fri, 12 Aug 2005 14:04:41 +0200 (CEST) Received: (from kettenis@localhost) by sibelius.xs4all.nl (8.13.0/8.13.0/Submit) id j7CC4eTT012838; Fri, 12 Aug 2005 14:04:40 +0200 (CEST) Date: Fri, 12 Aug 2005 16:30:00 -0000 Message-ID: <200506191030.j5JAUtRE023985@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: gdb-patches@sources.redhat.com CC: kevinb@redhat.com, cagney@gnu.org Subject: [ping] [RFA] Fix varargs calls for PowerPC System V ABI X-SW-Source: 2005-08/txt/msg00132.txt.bz2 Message-ID: <20050812163000.oBsclcXDzf8gDFRkIil6VU2y5mW0deU5_y0nS30G_5U@z> 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 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 * 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. */