Enable x32 support in gdbserver
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 13 Apr 2012 14:39:41 +0000 (14:39 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 13 Apr 2012 14:39:41 +0000 (14:39 +0000)
* 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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/Makefile.in
gdb/gdbserver/configure.srv
gdb/gdbserver/linux-x86-low.c

index bd74d765da6132e9d1352f7060040eb1ec59018e..0eb9f6cc611357db5a1f3937a2085e8db3bcd971 100644 (file)
@@ -1,3 +1,28 @@
+2012-04-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * 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  <palves@redhat.com>
 
        * Makefile.in (GNULIB_FLAGS_TO_PASS): New.
index de6e636273f81d8cd2d35aada3c35604bb376813..710129d56338a1550c57e1fbe4a04ea9e1430874 100644 (file)
@@ -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
index bdd99167b34541741f7bcf895cf4a30dbf74791f..e6ae157eed316e97afbfa128cf9267b0a1b56e86 100644 (file)
@@ -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.
 
index 1e65e97849185c477e363ece16fe895b6bb90758..4ea284eebafd16fea56c1ea5165dbe203ece2e30 100644 (file)
@@ -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