From: H.J. Lu Date: Fri, 13 Apr 2012 14:39:41 +0000 (+0000) Subject: Enable x32 support in gdbserver X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d47af5cf28a3fef4e6eff90379e66fa5bb95321;p=binutils-gdb.git Enable x32 support in gdbserver * Makefile.in (clean): Also remove x32.c x32-linux.c x32-avx.c x32-avx-linux.c. (x32.o): New target. (x32.c): Likewise. (x32-linux.o): Likewise. (x32-linux.c): Likewise. (x32-avx.o): Likewise. (x32-avx.c): Likewise. (x32-avx-linux.o): Likewise. (x32-avx-linux.c): Likewise. * configure.srv (srv_amd64_regobj): Add x32.o x32-avx.o. (srv_amd64_linux_regobj): Add x32-linux.o x32-avx-linux.o. (srv_i386_64bit_xmlfiles): Add i386/x32-core.xml. (srv_amd64_xmlfiles): Add i386/x32.xml i386/x32-avx.xml. (srv_amd64_linux_xmlfiles): Add i386/x32-linux.xml i386/x32-avx-linux.xml. * linux-x86-low.c (init_registers_x32_linux): New prototype. (init_registers_x32_avx_linux): Likwise. (x86_linux_update_xmltarget): Call init_registers_x32_linux or init_registers_x32_avx_linux if linux_is_elf64 is false. --- diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index bd74d765da6..0eb9f6cc611 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,28 @@ +2012-04-13 H.J. Lu + + * Makefile.in (clean): Also remove x32.c x32-linux.c + x32-avx.c x32-avx-linux.c. + (x32.o): New target. + (x32.c): Likewise. + (x32-linux.o): Likewise. + (x32-linux.c): Likewise. + (x32-avx.o): Likewise. + (x32-avx.c): Likewise. + (x32-avx-linux.o): Likewise. + (x32-avx-linux.c): Likewise. + + * configure.srv (srv_amd64_regobj): Add x32.o x32-avx.o. + (srv_amd64_linux_regobj): Add x32-linux.o x32-avx-linux.o. + (srv_i386_64bit_xmlfiles): Add i386/x32-core.xml. + (srv_amd64_xmlfiles): Add i386/x32.xml i386/x32-avx.xml. + (srv_amd64_linux_xmlfiles): Add i386/x32-linux.xml + i386/x32-avx-linux.xml. + + * linux-x86-low.c (init_registers_x32_linux): New prototype. + (init_registers_x32_avx_linux): Likwise. + (x86_linux_update_xmltarget): Call init_registers_x32_linux + or init_registers_x32_avx_linux if linux_is_elf64 is false. + 2012-04-13 Pedro Alves * Makefile.in (GNULIB_FLAGS_TO_PASS): New. diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index de6e636273f..710129d5633 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -314,6 +314,8 @@ clean: rm -f i386-avx.c i386-avx-linux.c rm -f amd64-avx.c amd64-avx-linux.c rm -f i386-mmx.c i386-mmx-linux.c + rm -f x32.c x32-linux.c + rm -f x32-avx.c x32-avx-linux.c @cd gnulib; $(MAKE) $(FLAGS_TO_PASS) $(GNULIB_FLAGS_TO_PASS) clean maintainer-clean realclean distclean: clean @@ -704,6 +706,18 @@ amd64-avx.c : $(srcdir)/../regformats/i386/amd64-avx.dat $(regdat_sh) amd64-avx-linux.o : amd64-avx-linux.c $(regdef_h) amd64-avx-linux.c : $(srcdir)/../regformats/i386/amd64-avx-linux.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/amd64-avx-linux.dat amd64-avx-linux.c +x32.o : x32.c $(regdef_h) +x32.c : $(srcdir)/../regformats/i386/x32.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32.dat x32.c +x32-linux.o : x32-linux.c $(regdef_h) +x32-linux.c : $(srcdir)/../regformats/i386/x32-linux.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-linux.dat x32-linux.c +x32-avx.o : x32-avx.c $(regdef_h) +x32-avx.c : $(srcdir)/../regformats/i386/x32-avx.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-avx.dat x32-avx.c +x32-avx-linux.o : x32-avx-linux.c $(regdef_h) +x32-avx-linux.c : $(srcdir)/../regformats/i386/x32-avx-linux.dat $(regdat_sh) + $(SHELL) $(regdat_sh) $(srcdir)/../regformats/i386/x32-avx-linux.dat x32-avx-linux.c reg-xtensa.o : reg-xtensa.c $(regdef_h) reg-xtensa.c : $(srcdir)/../regformats/reg-xtensa.dat $(regdat_sh) $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-xtensa.dat reg-xtensa.c diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index bdd99167b34..e6ae157eed3 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -26,18 +26,18 @@ srv_hostio_err_objs="hostio-errno.o" srv_i386_regobj="i386.o i386-avx.o i386-mmx.o" srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mmx-linux.o" -srv_amd64_regobj="amd64.o amd64-avx.o" -srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o" +srv_amd64_regobj="amd64.o amd64-avx.o x32.o x32-avx.o" +srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o x32-linux.o x32-avx-linux.o" ipa_i386_linux_regobj=i386-linux-ipa.o ipa_amd64_linux_regobj=amd64-linux-ipa.o srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml i386/32bit-avx.xml" -srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml" +srv_i386_64bit_xmlfiles="i386/64bit-core.xml i386/64bit-sse.xml i386/64bit-avx.xml i386/x32-core.xml" srv_i386_xmlfiles="i386/i386.xml i386/i386-avx.xml i386/i386-mmx.xml $srv_i386_32bit_xmlfiles" -srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml $srv_i386_64bit_xmlfiles" +srv_amd64_xmlfiles="i386/amd64.xml i386/amd64-avx.xml i386/x32.xml i386/x32-avx.xml $srv_i386_64bit_xmlfiles" srv_i386_linux_xmlfiles="i386/i386-linux.xml i386/i386-avx-linux.xml i386/i386-mmx-linux.xml i386/32bit-linux.xml $srv_i386_32bit_xmlfiles" -srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml $srv_i386_64bit_xmlfiles" +srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/64bit-linux.xml i386/x32-linux.xml i386/x32-avx-linux.xml $srv_i386_64bit_xmlfiles" # Input is taken from the "${target}" variable. diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 1e65e978491..4ea284eebaf 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -41,6 +41,10 @@ void init_registers_i386_avx_linux (void); void init_registers_amd64_avx_linux (void); /* Defined in auto-generated file i386-mmx-linux.c. */ void init_registers_i386_mmx_linux (void); +/* Defined in auto-generated file x32-linux.c. */ +void init_registers_x32_linux (void); +/* Defined in auto-generated file x32-avx-linux.c. */ +void init_registers_x32_avx_linux (void); static unsigned char jump_insn[] = { 0xe9, 0, 0, 0, 0 }; static unsigned char small_jump_insn[] = { 0x66, 0xe9, 0, 0 }; @@ -1158,8 +1162,10 @@ x86_linux_update_xmltarget (void) #ifdef __x86_64__ if (num_xmm_registers == 8) init_registers_i386_linux (); - else + else if (linux_is_elf64) init_registers_amd64_linux (); + else + init_registers_x32_linux (); #else { # ifdef HAVE_PTRACE_GETFPXREGS @@ -1254,8 +1260,10 @@ x86_linux_update_xmltarget (void) /* I386 has 8 xmm regs. */ if (num_xmm_registers == 8) init_registers_i386_avx_linux (); - else + else if (linux_is_elf64) init_registers_amd64_avx_linux (); + else + init_registers_x32_avx_linux (); #else init_registers_i386_avx_linux (); #endif