From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18695 invoked by alias); 7 Jun 2002 14:16:29 -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 18686 invoked from network); 7 Jun 2002 14:16:28 -0000 Received: from unknown (HELO kerberos.suse.cz) (195.47.106.10) by sources.redhat.com with SMTP; 7 Jun 2002 14:16:28 -0000 Received: from chimera.suse.cz (chimera.suse.cz [10.20.0.2]) by kerberos.suse.cz (SuSE SMTP server) with ESMTP id 71AA859D354 for ; Fri, 7 Jun 2002 16:16:27 +0200 (CEST) Received: from suse.cz (naga.suse.cz [10.20.1.16]) by chimera.suse.cz (8.11.0/8.11.0/SuSE Linux 8.11.0-0.4) with ESMTP id g57EGRp00665 for ; Fri, 7 Jun 2002 16:16:27 +0200 X-Authentication-Warning: chimera.suse.cz: Host naga.suse.cz [10.20.1.16] claimed to be suse.cz Message-ID: <3D00C03B.7050308@suse.cz> Date: Fri, 07 Jun 2002 07:16:00 -0000 From: Michal Ludvig Organization: SuSE CR User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: cs, cz, en MIME-Version: 1.0 To: GDB Patches Subject: [RFA] {supply,fill}_fpregset on x86-64 Content-Type: multipart/mixed; boundary="------------030803060608030802040404" X-SW-Source: 2002-06/txt/msg00109.txt.bz2 This is a multi-part message in MIME format. --------------030803060608030802040404 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Content-length: 401 Hi all, this patch eliminates the need of linking i387-tdep.o into x86-64 targeted gdb. Anyway it didn't work ;-) I have written supply_fpregset and fill_fpregset from scratch along with a supporing function x86_64_fxsave_offset. Lots of testsuite failures was fixed by this patch. Can I commit it? Michal Ludvig -- * SuSE CR, s.r.o * mludvig@suse.cz * +420 2 9654 5373 * http://www.suse.cz --------------030803060608030802040404 Content-Type: text/plain; name="fpregset.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="fpregset.diff" Content-length: 7687 2002-06-05 Michal Ludvig * x86-64-linux-nat.c (x86_64_fxsave_offset): New. (supply_fpregset, fill_fpregset): Don't call i387_*_fxsave, better do the things actually here. * x86-64-tdep.c (x86_64_register_name2nr): New. (x86_64_register_name): Renamed to x86_64_register_nr2name. (x86_64_gdbarch_init): Respect the above change. * x86-64-tdep.h (x86_64_register_name2nr) (x86_64_register_nr2name): Add prototypes. * config/i386/x86-64linux.mt (TDEPFILES): Remove i387-tdep.o. Index: x86-64-linux-nat.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/x86-64-linux-nat.c,v retrieving revision 1.12 diff -c -3 -p -r1.12 x86-64-linux-nat.c *** x86-64-linux-nat.c 11 May 2002 17:22:26 -0000 1.12 --- x86-64-linux-nat.c 5 Jun 2002 15:27:39 -0000 *************** *** 25,31 **** #include "inferior.h" #include "gdbcore.h" #include "regcache.h" - #include "i387-tdep.h" #include "gdb_assert.h" #include "x86-64-tdep.h" =20=20 --- 25,30 ---- *************** store_regs (int tid, int regno) *** 195,217 **** =20=20 /* Transfering floating-point registers between GDB, inferiors and cores.= */ =20=20 ! /* Fill GDB's register array with the floating-point register values in ! *FPREGSETP. */ !=20 ! void ! supply_fpregset (elf_fpregset_t * fpregsetp) { ! i387_supply_fxsave ((char *) fpregsetp); ! } =20=20 ! /* Fill register REGNO (if it is a floating-point register) in ! *FPREGSETP with the value in GDB's register array. If REGNO is -1, ! do this for all registers. */ =20=20 ! void ! fill_fpregset (elf_fpregset_t * fpregsetp, int regno) ! { ! i387_fill_fxsave ((char *) fpregsetp, regno); } =20=20 /* Fetch all floating-point registers from process/thread TID and store --- 194,266 ---- =20=20 /* Transfering floating-point registers between GDB, inferiors and cores.= */ =20=20 ! static void * ! x86_64_fxsave_offset (elf_fpregset_t *fxsave, int regnum) { ! char *reg_name; ! int reg_index; =20=20 ! gdb_assert (x86_64_num_gregs-1 < regnum=20 ! && regnum < x86_64_num_regs); =20=20 ! reg_name =3D x86_64_register_nr2name (regnum); !=20=09 ! if (reg_name[0] =3D=3D 's' && reg_name[1] =3D=3D 't') ! { ! reg_index =3D reg_name[2] - '0'; ! return &fxsave->st_space [reg_index * 2]; ! } !=20=09 ! if (reg_name[0] =3D=3D 'x' && reg_name[1] =3D=3D 'm' && reg_name[2] =3D= =3D 'm') ! { ! reg_index =3D reg_name[3] - '0'; ! return &fxsave->xmm_space [reg_index * 4]; ! } !=20=09 ! if (strcmp (reg_name, "mxcsr") =3D=3D 0) ! return &fxsave->mxcsr; !=20=09 ! return NULL; ! } ! /* Fill GDB's register array with the floating-point and SSE register ! values in *FXSAVE. This function masks off any of the reserved ! bits in *FXSAVE. */ !=20 ! void ! supply_fpregset (elf_fpregset_t *fxsave) ! { ! int i, reg_st0, reg_mxcsr; !=20=20=20 ! reg_st0 =3D x86_64_register_name2nr ("st0"); ! reg_mxcsr =3D x86_64_register_name2nr ("mxcsr"); !=20=20=20 ! gdb_assert (reg_st0 > 0 && reg_mxcsr > reg_st0); !=20=20=20 ! for (i =3D reg_st0; i <=3D reg_mxcsr; i++) ! supply_register (i, x86_64_fxsave_offset (fxsave, i)); ! } !=20 ! /* Fill register REGNUM (if it is a floating-point or SSE register) in ! *FXSAVE with the value in GDB's register array. If REGNUM is -1, do ! this for all registers. This function doesn't touch any of the ! reserved bits in *FXSAVE. */ !=20 ! void ! fill_fpregset (elf_fpregset_t *fxsave, int regnum) ! { ! int i, last_regnum =3D MXCSR_REGNUM; ! void *ptr; !=20 ! if (gdbarch_tdep (current_gdbarch)->num_xmm_regs =3D=3D 0) ! last_regnum =3D FOP_REGNUM; !=20 ! for (i =3D FP0_REGNUM; i <=3D last_regnum; i++) ! if (regnum =3D=3D -1 || regnum =3D=3D i) ! { ! ptr =3D x86_64_fxsave_offset (fxsave, i); ! if (ptr) ! regcache_collect (i, ptr); ! } } =20=20 /* Fetch all floating-point registers from process/thread TID and store Index: x86-64-tdep.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v retrieving revision 1.20 diff -c -3 -p -r1.20 x86-64-tdep.c *** x86-64-tdep.c 27 May 2002 13:37:38 -0000 1.20 --- x86-64-tdep.c 5 Jun 2002 15:27:39 -0000 *************** x86_64_store_return_value (struct type * *** 797,809 **** } =0C =20=20 ! static char * ! x86_64_register_name (int reg_nr) { if (reg_nr < 0 || reg_nr >=3D X86_64_NUM_REGS) return NULL; return x86_64_register_info_table[reg_nr].name; } =0C =20=20 =20=20 --- 797,820 ---- } =0C =20=20 ! char * ! x86_64_register_nr2name (int reg_nr) { if (reg_nr < 0 || reg_nr >=3D X86_64_NUM_REGS) return NULL; return x86_64_register_info_table[reg_nr].name; } +=20 + int=20 + x86_64_register_name2nr (const char *name) + { + int reg_nr; +=20=09 + for (reg_nr =3D 0; reg_nr < X86_64_NUM_REGS; reg_nr++) + if (strcmp (name, x86_64_register_info_table[reg_nr].name) =3D=3D 0) + return reg_nr; + return -1; + } =0C =20=20 =20=20 *************** x86_64_gdbarch_init (struct gdbarch_info *** 982,988 **** set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); =20=20 set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS); ! set_gdbarch_register_name (gdbarch, x86_64_register_name); set_gdbarch_register_size (gdbarch, 8); set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size); set_gdbarch_max_register_raw_size (gdbarch, 16); --- 988,994 ---- set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext); =20=20 set_gdbarch_num_regs (gdbarch, X86_64_NUM_REGS); ! set_gdbarch_register_name (gdbarch, x86_64_register_nr2name); set_gdbarch_register_size (gdbarch, 8); set_gdbarch_register_raw_size (gdbarch, x86_64_register_raw_size); set_gdbarch_max_register_raw_size (gdbarch, 16); Index: x86-64-tdep.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/x86-64-tdep.h,v retrieving revision 1.3 diff -c -3 -p -r1.3 x86-64-tdep.h *** x86-64-tdep.h 27 Mar 2002 10:21:26 -0000 1.3 --- x86-64-tdep.h 5 Jun 2002 15:27:39 -0000 *************** *** 28,33 **** --- 28,36 ---- extern int x86_64_num_regs; extern int x86_64_num_gregs; =20=20 + int x86_64_register_name2nr (const char *name); + char *x86_64_register_nr2name (int reg_nr); +=20 gdbarch_frame_saved_pc_ftype x86_64_linux_frame_saved_pc; gdbarch_saved_pc_after_call_ftype x86_64_linux_saved_pc_after_call; =20=20 Index: config/i386/x86-64linux.mt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/config/i386/x86-64linux.mt,v retrieving revision 1.3 diff -c -3 -p -r1.3 x86-64linux.mt *** config/i386/x86-64linux.mt 4 May 2002 15:52:39 -0000 1.3 --- config/i386/x86-64linux.mt 5 Jun 2002 15:27:39 -0000 *************** *** 1,3 **** # Target: AMD x86-64 running GNU/Linux ! TDEPFILES=3D x86-64-tdep.o x86-64-linux-tdep.o i387-tdep.o dwarf2cfi.o \ solib.o solib-svr4.o solib-legacy.o --- 1,3 ---- # Target: AMD x86-64 running GNU/Linux ! TDEPFILES=3D x86-64-tdep.o x86-64-linux-tdep.o dwarf2cfi.o \ solib.o solib-svr4.o solib-legacy.o --------------030803060608030802040404--