mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
Add x86 AVX support to gdbserver.
2010-04-07 H.J. Lu <hongjiu.lu@intel.com> * Makefile.in (clean): Updated. (i386-avx.o): New. (i386-avx.c): Likewise. (i386-avx-linux.o): Likewise. (i386-avx-linux.c): Likewise. (amd64-avx.o): Likewise. (amd64-avx.c): Likewise. (amd64-avx-linux.o): Likewise. (amd64-avx-linux.c): Likewise. * configure.srv (srv_i386_regobj): Add i386-avx.o. (srv_i386_linux_regobj): Add i386-avx-linux.o. (srv_amd64_regobj): Add amd64-avx.o. (srv_amd64_linux_regobj): Add amd64-avx-linux.o. (srv_i386_32bit_xmlfiles): Add i386/32bit-avx.xml. (srv_i386_64bit_xmlfiles): Add i386/64bit-avx.xml. (srv_i386_xmlfiles): Add i386/i386-avx.xml. (srv_amd64_xmlfiles): Add i386/amd64-avx.xml. (srv_i386_linux_xmlfiles): Add i386/i386-avx-linux.xml. (srv_amd64_linux_xmlfiles): Add i386/amd64-avx-linux.xml. * i387-fp.c: Include "i386-xstate.h". (i387_xsave): New. (i387_cache_to_xsave): Likewise. (i387_xsave_to_cache): Likewise. (x86_xcr0): Likewise. * i387-fp.h (i387_cache_to_xsave): Likewise. (i387_xsave_to_cache): Likewise. (x86_xcr0): Likewise. * linux-arm-low.c (target_regsets): Initialize nt_type to 0. * linux-crisv32-low.c (target_regsets): Likewise. * linux-m68k-low.c (target_regsets): Likewise. * linux-mips-low.c (target_regsets): Likewise. * linux-ppc-low.c (target_regsets): Likewise. * linux-s390-low.c (target_regsets): Likewise. * linux-sh-low.c (target_regsets): Likewise. * linux-sparc-low.c (target_regsets): Likewise. * linux-xtensa-low.c (target_regsets): Likewise. * linux-low.c: Include <sys/uio.h>. (regsets_fetch_inferior_registers): Support nt_type. (regsets_store_inferior_registers): Likewise. (linux_process_qsupported): New. (linux_target_ops): Add linux_process_qsupported. * linux-low.h (regset_info): Add nt_type. (linux_target_ops): Add process_qsupported. * linux-x86-low.c: Include "i386-xstate.h", "elf/common.h" and <sys/uio.h>. (init_registers_i386_avx_linux): New. (init_registers_amd64_avx_linux): Likewise. (xmltarget_i386_linux_no_xml): Likewise. (xmltarget_amd64_linux_no_xml): Likewise. (PTRACE_GETREGSET): Likewise. (PTRACE_SETREGSET): Likewise. (x86_fill_xstateregset): Likewise. (x86_store_xstateregset): Likewise. (use_xml): Likewise. (x86_linux_update_xmltarget): Likewise. (x86_linux_process_qsupported): Likewise. (target_regsets): Add NT_X86_XSTATE entry and Initialize nt_type. (x86_arch_setup): Don't call init_registers_amd64_linux nor init_registers_i386_linux here. Call x86_linux_update_xmltarget. (the_low_target): Add x86_linux_process_qsupported. * server.c (handle_query): Call target_process_qsupported. * target.h (target_ops): Add process_qsupported. (target_process_qsupported): New.
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <sys/uio.h>
|
||||
#ifndef ELFMAG0
|
||||
/* Don't include <linux/elf.h> here. If it got included by gdb_proc_service.h
|
||||
then ELFMAG0 will have been defined. If it didn't get included by
|
||||
@@ -2977,14 +2978,15 @@ regsets_fetch_inferior_registers (struct regcache *regcache)
|
||||
struct regset_info *regset;
|
||||
int saw_general_regs = 0;
|
||||
int pid;
|
||||
struct iovec iov;
|
||||
|
||||
regset = target_regsets;
|
||||
|
||||
pid = lwpid_of (get_thread_lwp (current_inferior));
|
||||
while (regset->size >= 0)
|
||||
{
|
||||
void *buf;
|
||||
int res;
|
||||
void *buf, *data;
|
||||
int nt_type, res;
|
||||
|
||||
if (regset->size == 0 || disabled_regsets[regset - target_regsets])
|
||||
{
|
||||
@@ -2993,10 +2995,21 @@ regsets_fetch_inferior_registers (struct regcache *regcache)
|
||||
}
|
||||
|
||||
buf = xmalloc (regset->size);
|
||||
|
||||
nt_type = regset->nt_type;
|
||||
if (nt_type)
|
||||
{
|
||||
iov.iov_base = buf;
|
||||
iov.iov_len = regset->size;
|
||||
data = (void *) &iov;
|
||||
}
|
||||
else
|
||||
data = buf;
|
||||
|
||||
#ifndef __sparc__
|
||||
res = ptrace (regset->get_request, pid, 0, buf);
|
||||
res = ptrace (regset->get_request, pid, nt_type, data);
|
||||
#else
|
||||
res = ptrace (regset->get_request, pid, buf, 0);
|
||||
res = ptrace (regset->get_request, pid, data, nt_type);
|
||||
#endif
|
||||
if (res < 0)
|
||||
{
|
||||
@@ -3034,14 +3047,15 @@ regsets_store_inferior_registers (struct regcache *regcache)
|
||||
struct regset_info *regset;
|
||||
int saw_general_regs = 0;
|
||||
int pid;
|
||||
struct iovec iov;
|
||||
|
||||
regset = target_regsets;
|
||||
|
||||
pid = lwpid_of (get_thread_lwp (current_inferior));
|
||||
while (regset->size >= 0)
|
||||
{
|
||||
void *buf;
|
||||
int res;
|
||||
void *buf, *data;
|
||||
int nt_type, res;
|
||||
|
||||
if (regset->size == 0 || disabled_regsets[regset - target_regsets])
|
||||
{
|
||||
@@ -3054,10 +3068,21 @@ regsets_store_inferior_registers (struct regcache *regcache)
|
||||
/* First fill the buffer with the current register set contents,
|
||||
in case there are any items in the kernel's regset that are
|
||||
not in gdbserver's regcache. */
|
||||
|
||||
nt_type = regset->nt_type;
|
||||
if (nt_type)
|
||||
{
|
||||
iov.iov_base = buf;
|
||||
iov.iov_len = regset->size;
|
||||
data = (void *) &iov;
|
||||
}
|
||||
else
|
||||
data = buf;
|
||||
|
||||
#ifndef __sparc__
|
||||
res = ptrace (regset->get_request, pid, 0, buf);
|
||||
res = ptrace (regset->get_request, pid, nt_type, data);
|
||||
#else
|
||||
res = ptrace (regset->get_request, pid, buf, 0);
|
||||
res = ptrace (regset->get_request, pid, &iov, data);
|
||||
#endif
|
||||
|
||||
if (res == 0)
|
||||
@@ -3067,9 +3092,9 @@ regsets_store_inferior_registers (struct regcache *regcache)
|
||||
|
||||
/* Only now do we write the register set. */
|
||||
#ifndef __sparc__
|
||||
res = ptrace (regset->set_request, pid, 0, buf);
|
||||
res = ptrace (regset->set_request, pid, nt_type, data);
|
||||
#else
|
||||
res = ptrace (regset->set_request, pid, buf, 0);
|
||||
res = ptrace (regset->set_request, pid, data, nt_type);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -4133,6 +4158,13 @@ linux_core_of_thread (ptid_t ptid)
|
||||
return core;
|
||||
}
|
||||
|
||||
static void
|
||||
linux_process_qsupported (const char *query)
|
||||
{
|
||||
if (the_low_target.process_qsupported != NULL)
|
||||
the_low_target.process_qsupported (query);
|
||||
}
|
||||
|
||||
static struct target_ops linux_target_ops = {
|
||||
linux_create_inferior,
|
||||
linux_attach,
|
||||
@@ -4176,7 +4208,8 @@ static struct target_ops linux_target_ops = {
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
linux_core_of_thread
|
||||
linux_core_of_thread,
|
||||
linux_process_qsupported
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user