This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc][1/2] add suport for 64-bit fpscr in powerpc linux native


Ping?

El miÃ, 24-09-2008 a las 13:54 -0300, Thiago Jung Bauermann escribiÃ:
> Ping?
> 
> El dom, 14-09-2008 a las 21:01 -0300, Thiago Jung Bauermann escribiÃ:
> > Hi,
> > 
> > The Power ISA 2.05 (implemented by Power6 and later) extended the FPSCR
> > from 32 bits to 64 bits. This patch makes GDB on native Linux display
> > the full extension of the register when it sees that it is running on
> > such a processor. I use the AUXV to detect the feature.
> > 
> > Ran the testsuite on ppc-linux and ppc64-linux, on a machine with 64-bit
> > FPSCR and also on a machine with a 32-bit FPSCR. No regressions found.
> > Ok?
> > -- 
> > []'s
> > Thiago Jung Bauermann
> > IBM Linux Technology Center
> > 
> > :ADDPATCH powerpc:
> > 
> > 2008-09-14  Thiago Jung Bauermann  <bauerman@br.ibm.com>
> > 
> > gdb/
> > 	* ppc-linux-nat.c (ppc_register_u_addr): Add special case to return
> > 	offset for full 64-bit slot of FPSCR when in 32-bits.
> > 	(ppc_linux_read_description): Return target description with 64-bit
> > 	FPSCR when inferior is running on an ISA 2.05 or later processor.
> > 	* ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Call
> > 	initialize_tdec_powerpc_isa205_32l,
> > 	initialize_tdec_powerpc_isa205_altivec32l,
> > 	initialize_tdec_powerpc_isa205_vsx32l,
> > 	initialize_tdec_powerpc_isa205_64l,
> > 	initialize_tdec_powerpc_isa205_altivec64l and
> > 	initialize_tdec_powerpc_isa205_vsx64l.
> > 	* ppc-linux-tdep.h: Add external declaration for
> > 	tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_altivec32l,
> > 	tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_isa205_64l,
> > 	tdesc_powerpc_isa205_altivec64l and tdesc_powerpc_isa205_vsx64l.
> > 	* features/rs600/powerpc-fpu-isa205.xml: New file.
> > 	* features/rs600/powerpc-isa205-32l.xml: New file.
> > 	* features/rs600/powerpc-isa205-64l.xml: New file.
> > 	* features/rs600/powerpc-isa205-altivec32l.xml: New file.
> > 	* features/rs600/powerpc-isa205-altivec64l.xml: New file.
> > 	* features/rs600/powerpc-isa205-vsx32l.xml: New file.
> > 	* features/rs600/powerpc-isa205-vsx64l.xml: New file.
> > 	* features/rs600/powerpc-isa205-32l.c: Generate.
> > 	* features/rs600/powerpc-isa205-64l.c: Generate.
> > 	* features/rs600/powerpc-isa205-altivec32l.c: Generate.
> > 	* features/rs600/powerpc-isa205-altivec64l.c: Generate.
> > 	* features/rs600/powerpc-isa205-vsx32l.c: Generate.
> > 	* features/rs600/powerpc-isa205-vsx64l.c: Generate.
> > 
> > gdb/testsuite/
> > 
> > 	* gdb.arch/ppc-dfp.exp: New file.
> > 	* gdb.arch/ppc-dfp.c: New file.
> > 
> > Index: gdb.git/gdb/features/rs6000/power-fpu-isa205.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/power-fpu-isa205.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,44 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!DOCTYPE feature SYSTEM "gdb-target.dtd">
> > +<feature name="org.gnu.gdb.power.fpu">
> > +  <reg name="f0" bitsize="64" type="ieee_double" regnum="32"/>
> > +  <reg name="f1" bitsize="64" type="ieee_double"/>
> > +  <reg name="f2" bitsize="64" type="ieee_double"/>
> > +  <reg name="f3" bitsize="64" type="ieee_double"/>
> > +  <reg name="f4" bitsize="64" type="ieee_double"/>
> > +  <reg name="f5" bitsize="64" type="ieee_double"/>
> > +  <reg name="f6" bitsize="64" type="ieee_double"/>
> > +  <reg name="f7" bitsize="64" type="ieee_double"/>
> > +  <reg name="f8" bitsize="64" type="ieee_double"/>
> > +  <reg name="f9" bitsize="64" type="ieee_double"/>
> > +  <reg name="f10" bitsize="64" type="ieee_double"/>
> > +  <reg name="f11" bitsize="64" type="ieee_double"/>
> > +  <reg name="f12" bitsize="64" type="ieee_double"/>
> > +  <reg name="f13" bitsize="64" type="ieee_double"/>
> > +  <reg name="f14" bitsize="64" type="ieee_double"/>
> > +  <reg name="f15" bitsize="64" type="ieee_double"/>
> > +  <reg name="f16" bitsize="64" type="ieee_double"/>
> > +  <reg name="f17" bitsize="64" type="ieee_double"/>
> > +  <reg name="f18" bitsize="64" type="ieee_double"/>
> > +  <reg name="f19" bitsize="64" type="ieee_double"/>
> > +  <reg name="f20" bitsize="64" type="ieee_double"/>
> > +  <reg name="f21" bitsize="64" type="ieee_double"/>
> > +  <reg name="f22" bitsize="64" type="ieee_double"/>
> > +  <reg name="f23" bitsize="64" type="ieee_double"/>
> > +  <reg name="f24" bitsize="64" type="ieee_double"/>
> > +  <reg name="f25" bitsize="64" type="ieee_double"/>
> > +  <reg name="f26" bitsize="64" type="ieee_double"/>
> > +  <reg name="f27" bitsize="64" type="ieee_double"/>
> > +  <reg name="f28" bitsize="64" type="ieee_double"/>
> > +  <reg name="f29" bitsize="64" type="ieee_double"/>
> > +  <reg name="f30" bitsize="64" type="ieee_double"/>
> > +  <reg name="f31" bitsize="64" type="ieee_double"/>
> > +
> > +  <reg name="fpscr" bitsize="64" group="float" regnum="70"/>
> > +</feature>
> > Index: gdb.git/gdb/features/rs6000/powerpc-isa205-32l.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/powerpc-isa205-32l.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,17 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!-- PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
> > +     view of the PowerPC.  Includes Linux-only special "registers".  -->
> > +
> > +<!DOCTYPE target SYSTEM "gdb-target.dtd">
> > +<target>
> > +  <architecture>powerpc:common</architecture>
> > +  <xi:include href="power-core.xml"/>
> > +  <xi:include href="power-fpu-isa205.xml"/>
> > +  <xi:include href="power-linux.xml"/>
> > +</target>
> > Index: gdb.git/gdb/features/rs6000/powerpc-isa205-64l.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/powerpc-isa205-64l.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,17 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!-- PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
> > +     view of the PowerPC.  Includes Linux-only special "registers".  -->
> > +
> > +<!DOCTYPE target SYSTEM "gdb-target.dtd">
> > +<target>
> > +  <architecture>powerpc:common64</architecture>
> > +  <xi:include href="power64-core.xml"/>
> > +  <xi:include href="power-fpu-isa205.xml"/>
> > +  <xi:include href="power64-linux.xml"/>
> > +</target>
> > Index: gdb.git/gdb/features/rs6000/powerpc-isa205-altivec32l.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/powerpc-isa205-altivec32l.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,19 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!-- PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
> > +     view of the PowerPC.  Includes Linux-only special "registers" and AltiVec
> > +     vector registers.  -->
> > +
> > +<!DOCTYPE target SYSTEM "gdb-target.dtd">
> > +<target>
> > +  <architecture>powerpc:common</architecture>
> > +  <xi:include href="power-core.xml"/>
> > +  <xi:include href="power-fpu-isa205.xml"/>
> > +  <xi:include href="power-linux.xml"/>
> > +  <xi:include href="power-altivec.xml"/>
> > +</target>
> > Index: gdb.git/gdb/features/rs6000/powerpc-isa205-altivec64l.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/powerpc-isa205-altivec64l.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,19 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!-- PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
> > +     view of the PowerPC.  Includes Linux-only special "registers" and AltiVec
> > +     vector registers.   -->
> > +
> > +<!DOCTYPE target SYSTEM "gdb-target.dtd">
> > +<target>
> > +  <architecture>powerpc:common64</architecture>
> > +  <xi:include href="power64-core.xml"/>
> > +  <xi:include href="power-fpu-isa205.xml"/>
> > +  <xi:include href="power64-linux.xml"/>
> > +  <xi:include href="power-altivec.xml"/>
> > +</target>
> > Index: gdb.git/gdb/features/rs6000/powerpc-isa205-vsx32l.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/powerpc-isa205-vsx32l.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,20 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!-- PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
> > +     view of the PowerPC.  Includes Linux-only special "registers", AltiVec
> > +     and VSX vector registers.  -->
> > +
> > +<!DOCTYPE target SYSTEM "gdb-target.dtd">
> > +<target>
> > +  <architecture>powerpc:common</architecture>
> > +  <xi:include href="power-core.xml"/>
> > +  <xi:include href="power-fpu-isa205.xml"/>
> > +  <xi:include href="power-linux.xml"/>
> > +  <xi:include href="power-altivec.xml"/>
> > +  <xi:include href="power-vsx.xml"/>
> > +</target>
> > Index: gdb.git/gdb/features/rs6000/powerpc-isa205-vsx64l.xml
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/features/rs6000/powerpc-isa205-vsx64l.xml	2008-09-14 20:58:22.000000000 -0300
> > @@ -0,0 +1,20 @@
> > +<?xml version="1.0"?>
> > +<!-- Copyright (C) 2008 Free Software Foundation, Inc.
> > +
> > +     Copying and distribution of this file, with or without modification,
> > +     are permitted in any medium without royalty provided the copyright
> > +     notice and this notice are preserved.  -->
> > +
> > +<!-- PowerPC UISA - a PPC processor as viewed by user-level code.  A UISA-only
> > +     view of the PowerPC.  Includes Linux-only special "registers", AltiVec
> > +     and VSX vector registers.   -->
> > +
> > +<!DOCTYPE target SYSTEM "gdb-target.dtd">
> > +<target>
> > +  <architecture>powerpc:common64</architecture>
> > +  <xi:include href="power64-core.xml"/>
> > +  <xi:include href="power-fpu-isa205.xml"/>
> > +  <xi:include href="power64-linux.xml"/>
> > +  <xi:include href="power-altivec.xml"/>
> > +  <xi:include href="power-vsx.xml"/>
> > +</target>
> > Index: gdb.git/gdb/ppc-linux-nat.c
> > ===================================================================
> > --- gdb.git.orig/gdb/ppc-linux-nat.c	2008-09-13 17:45:29.000000000 -0300
> > +++ gdb.git/gdb/ppc-linux-nat.c	2008-09-14 20:58:23.000000000 -0300
> > @@ -60,6 +60,10 @@
> >  #define PPC_FEATURE_BOOKE 0x00008000
> >  #endif
> >  
> > +#ifndef PPC_FEATURE_ARCH_2_05
> > +#define PPC_FEATURE_ARCH_2_05	0x00001000 /* ISA 2.05 */
> > +#endif
> > +
> >  /* Glibc's headers don't define PTRACE_GETVRREGS so we cannot use a
> >     configure time check.  Some older glibc's (for instance 2.2.1)
> >     don't have a specific powerpc version of ptrace.h, and fall back on
> > @@ -279,6 +283,12 @@ ppc_register_u_addr (struct gdbarch *gdb
> >  	 hence no adjustment is necessary.  Hack around this.  */
> >        if (wordsize == 8 && PT_FPSCR == (48 + 32 + 1))
> >  	u_addr = (48 + 32) * wordsize;
> > +      /* If the FPSCR is 64-bit wide, we need to fetch the whole 64-bit
> > +	 slot and not just its second word.  The PT_FPSCR supplied in a
> > +	 32-bit GDB compilation doesn't reflect this.  */
> > +      else if (wordsize == 4 && register_size (gdbarch, regno) == 8
> > +	       && PT_FPSCR == (48 + 2*32 + 1))
> > +	u_addr = (48 + 2*32) * wordsize;
> >        else
> >  	u_addr = PT_FPSCR * wordsize;
> >      }
> > @@ -1230,6 +1240,7 @@ ppc_linux_read_description (struct targe
> >  {
> >    int altivec = 0;
> >    int vsx = 0;
> > +  int isa205 = 0;
> >  
> >    int tid = TIDGET (inferior_ptid);
> >    if (tid == 0)
> > @@ -1274,6 +1285,9 @@ ppc_linux_read_description (struct targe
> >  	perror_with_name (_("Unable to fetch AltiVec registers"));
> >      }
> >  
> > +  if (ppc_linux_get_hwcap () & PPC_FEATURE_ARCH_2_05)
> > +    isa205 = 1;
> > +
> >    /* Check for 64-bit inferior process.  This is the case when the host is
> >       64-bit, and in addition the top bit of the MSR register is set.  */
> >  #ifdef __powerpc64__
> > @@ -1284,21 +1298,21 @@ ppc_linux_read_description (struct targe
> >      if (errno == 0 && msr < 0)
> >        {
> >  	if (vsx)
> > -	  return tdesc_powerpc_vsx64l;
> > +	  return isa205? tdesc_powerpc_isa205_vsx64l : tdesc_powerpc_vsx64l;
> >  	else if (altivec)
> > -	  return tdesc_powerpc_altivec64l;
> > +	  return isa205? tdesc_powerpc_isa205_altivec64l : tdesc_powerpc_altivec64l;
> >  
> > -	return tdesc_powerpc_64l;
> > +	return isa205? tdesc_powerpc_isa205_64l : tdesc_powerpc_64l;
> >        }
> >    }
> >  #endif
> >  
> >    if (vsx)
> > -    return tdesc_powerpc_vsx32l;
> > +    return isa205? tdesc_powerpc_isa205_vsx32l : tdesc_powerpc_vsx32l;
> >    else if (altivec)
> > -    return tdesc_powerpc_altivec32l;
> > +    return isa205? tdesc_powerpc_isa205_altivec32l : tdesc_powerpc_altivec32l;
> >  
> > -  return tdesc_powerpc_32l;
> > +  return isa205? tdesc_powerpc_isa205_32l : tdesc_powerpc_32l;
> >  }
> >  
> >  void _initialize_ppc_linux_nat (void);
> > Index: gdb.git/gdb/ppc-linux-tdep.c
> > ===================================================================
> > --- gdb.git.orig/gdb/ppc-linux-tdep.c	2008-09-13 17:45:29.000000000 -0300
> > +++ gdb.git/gdb/ppc-linux-tdep.c	2008-09-14 20:58:23.000000000 -0300
> > @@ -42,9 +42,15 @@
> >  #include "features/rs6000/powerpc-32l.c"
> >  #include "features/rs6000/powerpc-altivec32l.c"
> >  #include "features/rs6000/powerpc-vsx32l.c"
> > +#include "features/rs6000/powerpc-isa205-32l.c"
> > +#include "features/rs6000/powerpc-isa205-altivec32l.c"
> > +#include "features/rs6000/powerpc-isa205-vsx32l.c"
> >  #include "features/rs6000/powerpc-64l.c"
> >  #include "features/rs6000/powerpc-altivec64l.c"
> >  #include "features/rs6000/powerpc-vsx64l.c"
> > +#include "features/rs6000/powerpc-isa205-64l.c"
> > +#include "features/rs6000/powerpc-isa205-altivec64l.c"
> > +#include "features/rs6000/powerpc-isa205-vsx64l.c"
> >  #include "features/rs6000/powerpc-e500l.c"
> >  
> > 
> > @@ -1170,8 +1176,14 @@ _initialize_ppc_linux_tdep (void)
> >    initialize_tdesc_powerpc_32l ();
> >    initialize_tdesc_powerpc_altivec32l ();
> >    initialize_tdesc_powerpc_vsx32l ();
> > +  initialize_tdesc_powerpc_isa205_32l ();
> > +  initialize_tdesc_powerpc_isa205_altivec32l ();
> > +  initialize_tdesc_powerpc_isa205_vsx32l ();
> >    initialize_tdesc_powerpc_64l ();
> >    initialize_tdesc_powerpc_altivec64l ();
> >    initialize_tdesc_powerpc_vsx64l ();
> > +  initialize_tdesc_powerpc_isa205_64l ();
> > +  initialize_tdesc_powerpc_isa205_altivec64l ();
> > +  initialize_tdesc_powerpc_isa205_vsx64l ();
> >    initialize_tdesc_powerpc_e500l ();
> >  }
> > Index: gdb.git/gdb/ppc-linux-tdep.h
> > ===================================================================
> > --- gdb.git.orig/gdb/ppc-linux-tdep.h	2008-09-13 17:45:29.000000000 -0300
> > +++ gdb.git/gdb/ppc-linux-tdep.h	2008-09-14 20:58:23.000000000 -0300
> > @@ -42,9 +42,15 @@ int ppc_linux_trap_reg_p (struct gdbarch
> >  extern struct target_desc *tdesc_powerpc_32l;
> >  extern struct target_desc *tdesc_powerpc_altivec32l;
> >  extern struct target_desc *tdesc_powerpc_vsx32l;
> > +extern struct target_desc *tdesc_powerpc_isa205_32l;
> > +extern struct target_desc *tdesc_powerpc_isa205_altivec32l;
> > +extern struct target_desc *tdesc_powerpc_isa205_vsx32l;
> >  extern struct target_desc *tdesc_powerpc_e500l;
> >  extern struct target_desc *tdesc_powerpc_64l;
> >  extern struct target_desc *tdesc_powerpc_altivec64l;
> >  extern struct target_desc *tdesc_powerpc_vsx64l;
> > +extern struct target_desc *tdesc_powerpc_isa205_64l;
> > +extern struct target_desc *tdesc_powerpc_isa205_altivec64l;
> > +extern struct target_desc *tdesc_powerpc_isa205_vsx64l;
> >  
> >  #endif /* PPC_LINUX_TDEP_H */
> > Index: gdb.git/gdb/testsuite/gdb.arch/ppc-dfp.c
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/testsuite/gdb.arch/ppc-dfp.c	2008-09-14 20:58:23.000000000 -0300
> > @@ -0,0 +1,46 @@
> > +/* Copyright 2008 Free Software Foundation, Inc.
> > +
> > +   This file is part of GDB.
> > +
> > +   This program is free software; you can redistribute it and/or modify
> > +   it under the terms of the GNU General Public License as published by
> > +   the Free Software Foundation; either version 3 of the License, or
> > +   (at your option) any later version.
> > +
> > +   This program is distributed in the hope that it will be useful,
> > +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +   GNU General Public License for more details.
> > +
> > +   You should have received a copy of the GNU General Public License
> > +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> > +
> > +#include <elf.h>
> > +
> > +#ifdef __powerpc64__
> > +typedef Elf64_auxv_t auxv_t;
> > +#else
> > +typedef Elf32_auxv_t auxv_t;
> > +#endif
> > +
> > +#ifndef PPC_FEATURE_HAS_DFP
> > +#define PPC_FEATURE_HAS_DFP	0x00000400
> > +#endif
> > +
> > +int
> > +main (int argc, char *argv[], char *envp[], auxv_t auxv[])
> > +{
> > +  int i;
> > +
> > +  for (i = 0; auxv[i].a_type != AT_NULL; i++)
> > +    if (auxv[i].a_type == AT_HWCAP) {
> > +      if (!(auxv[i].a_un.a_val & PPC_FEATURE_HAS_DFP))
> > +	return 1;
> > +
> > +      break;
> > +    }
> > +
> > +  asm ("mtfsfi 7, 5, 1\n");  /* Set DFP rounding mode.  */
> > +
> > +  return 0;
> > +}
> > Index: gdb.git/gdb/testsuite/gdb.arch/ppc-dfp.exp
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ gdb.git/gdb/testsuite/gdb.arch/ppc-dfp.exp	2008-09-14 20:58:39.000000000 -0300
> > @@ -0,0 +1,82 @@
> > +# Copyright (C) 2008 Free Software Foundation, Inc.
> > +#
> > +# This program is free software; you can redistribute it and/or modify
> > +# it under the terms of the GNU General Public License as published by
> > +# the Free Software Foundation; either version 3 of the License, or
> > +# (at your option) any later version.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> > +#
> > +# Please email any bugs, comments, and/or additions to this file to:
> > +# bug-gdb@prep.ai.mit.edu
> > +#
> > +
> > +# Tests for Powerpc Decimal Floating Point registers setting and fetching
> > +
> > +if $tracelevel then {
> > +    strace $tracelevel
> > +}
> > +
> > +if ![istarget "powerpc*"] then {
> > +    verbose "Skipping powerpc decimal floating point register tests."
> > +    return
> > +}
> > +
> > +set testfile "ppc-dfp"
> > +set binfile ${objdir}/${subdir}/${testfile}
> > +set srcfile ${testfile}.c
> > +
> > +if [get_compiler_info $binfile] {
> > +    warning "get_compiler failed"
> > +    return -1
> > +}
> > +
> > +if ![test_compiler_info gcc*] {
> > +    # We use GCC's extended asm syntax
> > +    warning "unknown compiler"
> > +    return -1
> > +}
> > +
> > +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {quiet debug}] != "" } {
> > +    unsupported "This machine doesn't support Decimal Floating Point."
> > +    return -1
> > +}
> > +
> > +# Start with a fresh gdb.
> > +
> > +gdb_exit
> > +gdb_start
> > +gdb_reinitialize_dir $srcdir/$subdir
> > +gdb_load ${binfile}
> > +
> > +gdb_breakpoint [gdb_get_line_number "Set DFP rounding mode."]
> > +
> > +gdb_run_cmd
> > +
> > +# When the prompt comes back we'll be at the Set DFP rounding mode breakpoint.
> > +# Unless the program bails out after checking AT_HWCAP.
> > +gdb_expect {
> > +  -re "Program exited with code 01.\[\r\n\]+$gdb_prompt $" {
> > +    unsupported "This machine doesn't support Decimal Floating Point."
> > +    return -1
> > +  }
> > +
> > +  -re ".*$gdb_prompt $" {}
> > +}
> > +
> > +# First, verify if FPSCR is all zeroes.
> > +gdb_test "print \$fpscr" " = 0" "FPSCR is all zeroes"
> > +
> > +# Step over "set rounding mode" instruction.
> > +gdb_test "next" "" ""
> > +
> > +# Verify that the following bits are set (See Power ISA for details):
> > +#
> > +# 29:31 - DFP Rounding Control
> > +gdb_test "print/t \$fpscr" " = 10100000000000000000000000000000000" "FPSCR for round to nearest, ties toward zero rounding mode"
> > 
> > 
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]