binutils-gdb/gdb/gdbserver/nto-x86-low.c

109 lines
2.4 KiB
C
Raw Normal View History

/* QNX Neutrino specific low level interface, for the remote server
for GDB.
Copyright (C) 2009-2018 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "server.h"
#include "nto-low.h"
#include "regdef.h"
#include "regcache.h"
#include <x86/context.h>
Convert the rest x86 target descriptions This patch changes the rest of x86 target descriptions in GDB and GDBserver. gdb: 2017-09-05 Yao Qi <yao.qi@linaro.org> * amd64-tdep.c (amd64_target_description): Create target descriptions. (_initialize_amd64_tdep): Don't call functions initialize_tdesc_amd64_*. Add self tests. * arch/amd64.c (amd64_create_target_description): Add parameter is_linux. Call set_tdesc_osabi if is_linux is true. * arch/amd64.h (amd64_create_target_description): Update the declaration. * arch/i386.c (i386_create_target_description): Add parameter is_linux. Call set_tdesc_osabi if is_linux is true. * arch/i386.h (i386_create_target_description): Update declaration. * configure.tgt: Add i386.o to gdb_target_obs. * features/Makefile (XMLTOC): Remove i386/*.xml. * features/i386/amd64-avx-avx512.c: Remove. * features/i386/amd64-avx-mpx-avx512-pku.c: Remove. * features/i386/amd64-avx-mpx.c: Remove. * features/i386/amd64-avx.c: Remove. * features/i386/amd64-mpx.c: Remove. * features/i386/amd64.c: Remove. * features/i386/i386-avx-avx512.c: Remove. * features/i386/i386-avx-mpx-avx512-pku.c: Remove. * features/i386/i386-avx-mpx.c: Remove. * features/i386/i386-avx.c: Remove. * features/i386/i386-mmx.c: Remove. * features/i386/i386-mpx.c: Remove. * features/i386/i386.c: Remove. * i386-tdep.c: Don't include features/i386/i386*.c., include target-descriptions.h and arch/i386.h. (i386_target_description): Create target descriptions. (i386_gdbarch_init): Don't call initialize_tdesc_i386_* functions. Do self tests. gdb/gdbserver: 2017-09-05 Yao Qi <yao.qi@linaro.org> * configure.srv (srv_i386_regobj): Remove. (srv_amd64_regobj): Remove. (srv_regobj): Set it to "" for x86 non-linux targets. * linux-x86-tdesc.c (i386_linux_read_description): * lynx-i386-low.c: Include x86-xstate.h and arch/i386.h. (init_registers_i386): Remove the declaration. (tdesc_i386): Remove the declaration. (lynx_i386_arch_setup): Call i386_create_target_description. * nto-x86-low.c: Likewise. * win32-i386-low.c [__x86_64__]: include arch/amd64.h. [!__x86_64__]: include arch/i386.h. (i386_arch_setup) [__x86_64__]: Call amd64_create_target_description.
2017-09-05 10:54:54 +02:00
#include "x86-xstate.h"
#include "arch/i386.h"
const unsigned char x86_breakpoint[] = { 0xCC };
#define x86_breakpoint_len 1
/* Returns offset in appropriate Neutrino's context structure.
Defined in x86/context.h.
GDBREGNO is index into regs_i386 array. It is autogenerated and
hopefully doesn't change. */
static int
nto_x86_register_offset (int gdbregno)
{
if (gdbregno >= 0 && gdbregno < 16)
{
X86_CPU_REGISTERS *dummy = (void*)0;
/* GPRs */
switch (gdbregno)
{
case 0:
return (int)&(dummy->eax);
case 1:
return (int)&(dummy->ecx);
case 2:
return (int)&(dummy->edx);
case 3:
return (int)&(dummy->ebx);
case 4:
return (int)&(dummy->esp);
case 5:
return (int)&(dummy->ebp);
case 6:
return (int)&(dummy->esi);
case 7:
return (int)&(dummy->edi);
case 8:
return (int)&(dummy->eip);
case 9:
return (int)&(dummy->efl);
case 10:
return (int)&(dummy->cs);
case 11:
return (int)&(dummy->ss);
#ifdef __SEGMENTS__
case 12:
return (int)&(dummy->ds);
case 13:
return (int)&(dummy->es);
case 14:
return (int)&(dummy->fs);
case 15:
return (int)&(dummy->gs);
#endif
default:
return -1;
}
}
return -1;
}
static void
nto_x86_arch_setup (void)
{
the_low_target.num_regs = 16;
struct target_desc *tdesc
= i386_create_target_description (X86_XSTATE_SSE_MASK, false);
init_target_desc (tdesc);
nto_tdesc = tdesc;
}
struct nto_target_ops the_low_target =
{
nto_x86_arch_setup,
0, /* num_regs */
nto_x86_register_offset,
x86_breakpoint,
x86_breakpoint_len
};