From 117ce5436248fc716d7328850061120ba2e05bbf Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Wed, 13 Jun 2007 18:50:38 +0000 Subject: [PATCH] * features/Makefile: Generate regformats for mips-linux and mips64-linux. * features/sort-regs.xsl: Correct typo. * regformats/reg-mips.dat, regformats/reg-mips64.dat: Delete. * regformats/mips-linux.dat, regformats/mips64-linux.dat: New generated files. * Makefile.in (clean): Clean new files instead of deleted ones. (reg-mips.o, reg-mips.c, reg-mips64.o, reg-mips64.c): Delete. (mips-linux.o, mips-linux.c, mips64-linux.o, mips64-linux.c): New rules. * configure.srv: Specify XML files and new regformats for MIPS and MIPS64 GNU/Linux. * linux-mips-low.c (mips_num_regs): Set to only used registers. (mips_regmap): Do not fetch $0. Remove unused registers. Add an entry for the restart register. (mips_cannot_fetch_register, mips_cannot_store_register) (mips_reinsert_addr, mips_fill_fpregset, mips_store_fpregset): Update register names to match the XML descriptions. (mips_fill_gregset, mips_store_gregset): Likewise. Handle the restart register instead of $0. --- gdb/ChangeLog | 9 ++++ gdb/features/Makefile | 4 +- gdb/features/sort-regs.xsl | 2 +- gdb/gdbserver/ChangeLog | 17 ++++++++ gdb/gdbserver/Makefile.in | 18 ++++---- gdb/gdbserver/configure.srv | 8 +++- gdb/gdbserver/linux-mips-low.c | 35 +++++++-------- gdb/regformats/mips-linux.dat | 76 +++++++++++++++++++++++++++++++++ gdb/regformats/mips64-linux.dat | 76 +++++++++++++++++++++++++++++++++ 9 files changed, 215 insertions(+), 30 deletions(-) create mode 100644 gdb/regformats/mips-linux.dat create mode 100644 gdb/regformats/mips64-linux.dat diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 248ce7b1f4b..35a15900abb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2007-06-13 Daniel Jacobowitz + + * features/Makefile: Generate regformats for mips-linux and + mips64-linux. + * features/sort-regs.xsl: Correct typo. + * regformats/reg-mips.dat, regformats/reg-mips64.dat: Delete. + * regformats/mips-linux.dat, regformats/mips64-linux.dat: New generated + files. + 2007-06-13 Daniel Jacobowitz * config/mips/linux.mh (TDEP_XML): New. diff --git a/gdb/features/Makefile b/gdb/features/Makefile index 3442f8b602e..e1162665198 100644 --- a/gdb/features/Makefile +++ b/gdb/features/Makefile @@ -25,10 +25,12 @@ # affected XML files is changed, and the results should be kept in the # GDB repository. -WHICH = arm-with-iwmmxt +WHICH = arm-with-iwmmxt mips-linux mips64-linux # Record which registers should be sent to GDB by default after stop. arm-with-iwmmxt-expedite = r11,sp,pc +mips-linux-expedite = r29,pc +mips64-linux-expedite = r29,pc XSLTPROC = xsltproc outdir = ../regformats diff --git a/gdb/features/sort-regs.xsl b/gdb/features/sort-regs.xsl index c89fcce6924..5a99ec85dd1 100644 --- a/gdb/features/sort-regs.xsl +++ b/gdb/features/sort-regs.xsl @@ -3,7 +3,7 @@ - + diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 994fe8d53e6..17efed1decb 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,20 @@ +2007-06-13 Daniel Jacobowitz + + * Makefile.in (clean): Clean new files instead of deleted ones. + (reg-mips.o, reg-mips.c, reg-mips64.o, reg-mips64.c): Delete. + (mips-linux.o, mips-linux.c, mips64-linux.o, mips64-linux.c): New + rules. + * configure.srv: Specify XML files and new regformats for MIPS and + MIPS64 GNU/Linux. + * linux-mips-low.c (mips_num_regs): Set to only used registers. + (mips_regmap): Do not fetch $0. Remove unused registers. Add + an entry for the restart register. + (mips_cannot_fetch_register, mips_cannot_store_register) + (mips_reinsert_addr, mips_fill_fpregset, mips_store_fpregset): Update + register names to match the XML descriptions. + (mips_fill_gregset, mips_store_gregset): Likewise. Handle the + restart register instead of $0. + 2007-06-12 Ulrich Weigand Markus Deuling diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index fad796304e6..4ebf5083046 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -215,10 +215,10 @@ clean: rm -f *.o ${ADD_FILES} *~ rm -f version.c rm -f gdbserver$(EXEEXT) gdbreplay$(EXEEXT) core make.log - rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c reg-mips.c + rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c rm -f reg-ppc.c reg-sh.c reg-spu.c reg-x86-64.c reg-i386-linux.c - rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c reg-mips64.c - rm -f arm-with-iwmmxt.c + rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c + rm -f arm-with-iwmmxt.c mips-linux.c mips64-linux.c rm -f xml-builtin.c stamp-xml target.xml maintainer-clean realclean distclean: clean @@ -344,12 +344,12 @@ reg-m32r.c : $(srcdir)/../regformats/reg-m32r.dat $(regdat_sh) reg-m68k.o : reg-m68k.c $(regdef_h) reg-m68k.c : $(srcdir)/../regformats/reg-m68k.dat $(regdat_sh) sh $(regdat_sh) $(srcdir)/../regformats/reg-m68k.dat reg-m68k.c -reg-mips.o : reg-mips.c $(regdef_h) -reg-mips.c : $(srcdir)/../regformats/reg-mips.dat $(regdat_sh) - sh $(regdat_sh) $(srcdir)/../regformats/reg-mips.dat reg-mips.c -reg-mips64.o : reg-mips64.c $(regdef_h) -reg-mips64.c : $(srcdir)/../regformats/reg-mips64.dat $(regdat_sh) - sh $(regdat_sh) $(srcdir)/../regformats/reg-mips64.dat reg-mips64.c +mips-linux.o : mips-linux.c $(regdef_h) +mips-linux.c : $(srcdir)/../regformats/mips-linux.dat $(regdat_sh) + sh $(regdat_sh) $(srcdir)/../regformats/mips-linux.dat mips-linux.c +mips64-linux.o : mips64-linux.c $(regdef_h) +mips64-linux.c : $(srcdir)/../regformats/mips64-linux.dat $(regdat_sh) + sh $(regdat_sh) $(srcdir)/../regformats/mips64-linux.dat mips64-linux.c reg-ppc.o : reg-ppc.c $(regdef_h) reg-ppc.c : $(srcdir)/../regformats/reg-ppc.dat $(regdat_sh) sh $(regdat_sh) $(srcdir)/../regformats/reg-ppc.dat reg-ppc.c diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 8f39e903a3a..ff14adc02bc 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -83,13 +83,17 @@ case "${target}" in srv_linux_regsets=yes srv_linux_thread_db=yes ;; - mips*64*-*-linux*) srv_regobj=reg-mips64.o + mips*64*-*-linux*) srv_regobj=mips64-linux.o + srv_xmltarget=mips64-linux.xml + srv_xmlfiles="mips64-cpu.xml mips64-cp0.xml mips64-fpu.xml" srv_tgtobj="linux-low.o linux-mips-low.o" srv_linux_regsets=yes srv_linux_usrregs=yes srv_linux_thread_db=yes ;; - mips*-*-linux*) srv_regobj=reg-mips.o + mips*-*-linux*) srv_regobj=mips-linux.o + srv_xmltarget=mips-linux.xml + srv_xmlfiles="mips-cpu.xml mips-cp0.xml mips-fpu.xml" srv_tgtobj="linux-low.o linux-mips-low.o" srv_linux_regsets=yes srv_linux_usrregs=yes diff --git a/gdb/gdbserver/linux-mips-low.c b/gdb/gdbserver/linux-mips-low.c index 2921b289646..615f8d7e368 100644 --- a/gdb/gdbserver/linux-mips-low.c +++ b/gdb/gdbserver/linux-mips-low.c @@ -35,7 +35,7 @@ #include #endif -#define mips_num_regs 90 +#define mips_num_regs 73 #include @@ -50,9 +50,8 @@ union mips_register /* Return the ptrace ``address'' of register REGNO. */ -/* Matches mips_generic32_regs */ static int mips_regmap[] = { - 0, 1, 2, 3, 4, 5, 6, 7, + -1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, @@ -69,9 +68,7 @@ static int mips_regmap[] = { FPR_BASE + 28, FPR_BASE + 29, FPR_BASE + 30, FPR_BASE + 31, FPC_CSR, FPC_EIR, - -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, + 0 }; /* From mips-linux-nat.c. */ @@ -87,7 +84,7 @@ mips_cannot_fetch_register (int regno) if (mips_regmap[regno] == -1) return 1; - if (find_regno ("zero") == regno) + if (find_regno ("r0") == regno) return 1; return 0; @@ -99,13 +96,13 @@ mips_cannot_store_register (int regno) if (mips_regmap[regno] == -1) return 1; - if (find_regno ("zero") == regno) + if (find_regno ("r0") == regno) return 1; if (find_regno ("cause") == regno) return 1; - if (find_regno ("bad") == regno) + if (find_regno ("badvaddr") == regno) return 1; if (find_regno ("fir") == regno) @@ -145,7 +142,7 @@ static CORE_ADDR mips_reinsert_addr () { union mips_register ra; - collect_register_by_name ("ra", ra.buf); + collect_register_by_name ("r31", ra.buf); return register_size (0) == 4 ? ra.reg32 : ra.reg64; } @@ -242,15 +239,17 @@ mips_fill_gregset (void *buf) use_64bit = (register_size (0) == 8); - for (i = 0; i < 32; i++) + for (i = 1; i < 32; i++) mips_collect_register (use_64bit, i, regset + i); mips_collect_register (use_64bit, find_regno ("lo"), regset + 32); mips_collect_register (use_64bit, find_regno ("hi"), regset + 33); mips_collect_register (use_64bit, find_regno ("pc"), regset + 34); - mips_collect_register (use_64bit, find_regno ("bad"), regset + 35); - mips_collect_register (use_64bit, find_regno ("sr"), regset + 36); + mips_collect_register (use_64bit, find_regno ("badvaddr"), regset + 35); + mips_collect_register (use_64bit, find_regno ("status"), regset + 36); mips_collect_register (use_64bit, find_regno ("cause"), regset + 37); + + mips_collect_register (use_64bit, find_regno ("restart"), regset + 0); } static void @@ -267,9 +266,11 @@ mips_store_gregset (const void *buf) mips_supply_register (use_64bit, find_regno ("lo"), regset + 32); mips_supply_register (use_64bit, find_regno ("hi"), regset + 33); mips_supply_register (use_64bit, find_regno ("pc"), regset + 34); - mips_supply_register (use_64bit, find_regno ("bad"), regset + 35); - mips_supply_register (use_64bit, find_regno ("sr"), regset + 36); + mips_supply_register (use_64bit, find_regno ("badvaddr"), regset + 35); + mips_supply_register (use_64bit, find_regno ("status"), regset + 36); mips_supply_register (use_64bit, find_regno ("cause"), regset + 37); + + mips_supply_register (use_64bit, find_regno ("restart"), regset + 0); } static void @@ -290,7 +291,7 @@ mips_fill_fpregset (void *buf) collect_register (first_fp + i, regset[i & ~1].buf + 4 * (big_endian != (i & 1))); - mips_collect_register_32bit (use_64bit, find_regno ("fsr"), regset[32].buf); + mips_collect_register_32bit (use_64bit, find_regno ("fcsr"), regset[32].buf); mips_collect_register_32bit (use_64bit, find_regno ("fir"), regset[32].buf + 4); } @@ -313,7 +314,7 @@ mips_store_fpregset (const void *buf) supply_register (first_fp + i, regset[i & ~1].buf + 4 * (big_endian != (i & 1))); - mips_supply_register_32bit (use_64bit, find_regno ("fsr"), regset[32].buf); + mips_supply_register_32bit (use_64bit, find_regno ("fcsr"), regset[32].buf); mips_supply_register_32bit (use_64bit, find_regno ("fir"), regset[32].buf + 4); } diff --git a/gdb/regformats/mips-linux.dat b/gdb/regformats/mips-linux.dat new file mode 100644 index 00000000000..38c47d421ab --- /dev/null +++ b/gdb/regformats/mips-linux.dat @@ -0,0 +1,76 @@ +# DO NOT EDIT: generated from mips-linux.xml +name:mips_linux +expedite:r29,pc +32:r0 +32:r1 +32:r2 +32:r3 +32:r4 +32:r5 +32:r6 +32:r7 +32:r8 +32:r9 +32:r10 +32:r11 +32:r12 +32:r13 +32:r14 +32:r15 +32:r16 +32:r17 +32:r18 +32:r19 +32:r20 +32:r21 +32:r22 +32:r23 +32:r24 +32:r25 +32:r26 +32:r27 +32:r28 +32:r29 +32:r30 +32:r31 +32:status +32:lo +32:hi +32:badvaddr +32:cause +32:pc +32:f0 +32:f1 +32:f2 +32:f3 +32:f4 +32:f5 +32:f6 +32:f7 +32:f8 +32:f9 +32:f10 +32:f11 +32:f12 +32:f13 +32:f14 +32:f15 +32:f16 +32:f17 +32:f18 +32:f19 +32:f20 +32:f21 +32:f22 +32:f23 +32:f24 +32:f25 +32:f26 +32:f27 +32:f28 +32:f29 +32:f30 +32:f31 +32:fcsr +32:fir +32:restart diff --git a/gdb/regformats/mips64-linux.dat b/gdb/regformats/mips64-linux.dat new file mode 100644 index 00000000000..00494576a7e --- /dev/null +++ b/gdb/regformats/mips64-linux.dat @@ -0,0 +1,76 @@ +# DO NOT EDIT: generated from mips64-linux.xml +name:mips64_linux +expedite:r29,pc +64:r0 +64:r1 +64:r2 +64:r3 +64:r4 +64:r5 +64:r6 +64:r7 +64:r8 +64:r9 +64:r10 +64:r11 +64:r12 +64:r13 +64:r14 +64:r15 +64:r16 +64:r17 +64:r18 +64:r19 +64:r20 +64:r21 +64:r22 +64:r23 +64:r24 +64:r25 +64:r26 +64:r27 +64:r28 +64:r29 +64:r30 +64:r31 +64:status +64:lo +64:hi +64:badvaddr +64:cause +64:pc +64:f0 +64:f1 +64:f2 +64:f3 +64:f4 +64:f5 +64:f6 +64:f7 +64:f8 +64:f9 +64:f10 +64:f11 +64:f12 +64:f13 +64:f14 +64:f15 +64:f16 +64:f17 +64:f18 +64:f19 +64:f20 +64:f21 +64:f22 +64:f23 +64:f24 +64:f25 +64:f26 +64:f27 +64:f28 +64:f29 +64:f30 +64:f31 +64:fcsr +64:fir +64:restart -- 2.30.2