2013-02-04 20:48:37 +08:00
|
|
|
/* Common target dependent code for GDB on AArch64 systems.
|
|
|
|
|
2018-01-01 12:43:02 +08:00
|
|
|
Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
2013-02-04 20:48:37 +08:00
|
|
|
Contributed by ARM Ltd.
|
|
|
|
|
|
|
|
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/>. */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef AARCH64_TDEP_H
|
|
|
|
#define AARCH64_TDEP_H
|
|
|
|
|
2017-10-25 16:06:41 +08:00
|
|
|
#include "arch/aarch64.h"
|
|
|
|
|
2013-02-04 20:48:37 +08:00
|
|
|
/* Forward declarations. */
|
|
|
|
struct gdbarch;
|
|
|
|
struct regset;
|
|
|
|
|
|
|
|
/* AArch64 Dwarf register numbering. */
|
|
|
|
#define AARCH64_DWARF_X0 0
|
|
|
|
#define AARCH64_DWARF_SP 31
|
|
|
|
#define AARCH64_DWARF_V0 64
|
|
|
|
|
|
|
|
/* Size of integer registers. */
|
|
|
|
#define X_REGISTER_SIZE 8
|
|
|
|
#define B_REGISTER_SIZE 1
|
|
|
|
#define H_REGISTER_SIZE 2
|
|
|
|
#define S_REGISTER_SIZE 4
|
|
|
|
#define D_REGISTER_SIZE 8
|
|
|
|
#define V_REGISTER_SIZE 16
|
|
|
|
#define Q_REGISTER_SIZE 16
|
|
|
|
|
|
|
|
/* Total number of general (X) registers. */
|
|
|
|
#define AARCH64_X_REGISTER_COUNT 32
|
2016-10-11 19:12:46 +08:00
|
|
|
/* Total number of D registers. */
|
|
|
|
#define AARCH64_D_REGISTER_COUNT 32
|
2013-02-04 20:48:37 +08:00
|
|
|
|
Support displaced stepping in aarch64-linux
This patch is to support displaced stepping in aarch64-linux. A
visitor is implemented for displaced stepping, and used to record
information to fixup pc after displaced stepping if needed. Some
emit_* functions are converted to macros, and moved to
arch/aarch64-insn.{c,h} so that they can be shared.
gdb:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c: Include arch-utils.h.
(aarch64_linux_init_abi): Call set_gdbarch_max_insn_length,
set_gdbarch_displaced_step_copy_insn,
set_gdbarch_displaced_step_fixup,
set_gdbarch_displaced_step_free_closure,
set_gdbarch_displaced_step_location,
and set_gdbarch_displaced_step_hw_singlestep.
* aarch64-tdep.c (struct displaced_step_closure): New.
(struct aarch64_displaced_step_data): New.
(aarch64_displaced_step_b): New function.
(aarch64_displaced_step_b_cond): Likewise.
(aarch64_register): Likewise.
(aarch64_displaced_step_cb): Likewise.
(aarch64_displaced_step_tb): Likewise.
(aarch64_displaced_step_adr): Likewise.
(aarch64_displaced_step_ldr_literal): Likewise.
(aarch64_displaced_step_others): Likewise.
(aarch64_displaced_step_copy_insn): Likewise.
(aarch64_displaced_step_fixup): Likewise.
(aarch64_displaced_step_hw_singlestep): Likewise.
* aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): New macro.
(aarch64_displaced_step_copy_insn): Declare.
(aarch64_displaced_step_fixup): Declare.
(aarch64_displaced_step_hw_singlestep): Declare.
* arch/aarch64-insn.c (emit_insn): Moved from
gdbserver/linux-aarch64-low.c.
(emit_load_store): Likewise.
* arch/aarch64-insn.h (enum aarch64_opcodes): Moved from
gdbserver/linux-aarch64-low.c.
(struct aarch64_register): Likewise.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(can_encode_int32): New macro.
(emit_b, emit_bcond, emit_cb, emit_ldr, emit_ldrsw): Likewise.
(emit_tb, emit_nop): Likewise.
(emit_insn): Declare.
(emit_load_store): Declare.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (enum aarch64_opcodes): Move to
arch/aarch64-insn.h.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(emit_insn): Move to arch/aarch64-insn.c.
(emit_b, emit_bcond, emit_cb, emit_tb): Remove.
(emit_load_store): Move to arch/aarch64-insn.c.
(emit_ldr, emit_ldrb, emit_ldrsw, emit_nop): Remove.
(can_encode_int32): Remove.
2015-10-12 18:28:38 +08:00
|
|
|
/* The maximum number of modified instructions generated for one
|
|
|
|
single-stepped instruction. */
|
|
|
|
#define DISPLACED_MODIFIED_INSNS 1
|
|
|
|
|
2013-02-04 20:48:37 +08:00
|
|
|
/* Target-dependent structure in gdbarch. */
|
|
|
|
struct gdbarch_tdep
|
|
|
|
{
|
|
|
|
/* Lowest address at which instructions will appear. */
|
|
|
|
CORE_ADDR lowest_pc;
|
|
|
|
|
|
|
|
/* Offset to PC value in jump buffer. If this is negative, longjmp
|
|
|
|
support will be disabled. */
|
|
|
|
int jb_pc;
|
|
|
|
|
|
|
|
/* And the size of each entry in the buf. */
|
|
|
|
size_t jb_elt_size;
|
|
|
|
|
|
|
|
/* Types for AdvSISD registers. */
|
|
|
|
struct type *vnq_type;
|
|
|
|
struct type *vnd_type;
|
|
|
|
struct type *vns_type;
|
|
|
|
struct type *vnh_type;
|
|
|
|
struct type *vnb_type;
|
2015-05-11 19:10:46 +08:00
|
|
|
|
|
|
|
/* syscall record. */
|
|
|
|
int (*aarch64_syscall_record) (struct regcache *regcache, unsigned long svc_number);
|
2013-02-04 20:48:37 +08:00
|
|
|
};
|
|
|
|
|
2017-11-24 18:00:54 +08:00
|
|
|
const target_desc *aarch64_read_description ();
|
2015-02-17 00:24:53 +08:00
|
|
|
|
2015-05-11 19:10:46 +08:00
|
|
|
extern int aarch64_process_record (struct gdbarch *gdbarch,
|
|
|
|
struct regcache *regcache, CORE_ADDR addr);
|
|
|
|
|
Support displaced stepping in aarch64-linux
This patch is to support displaced stepping in aarch64-linux. A
visitor is implemented for displaced stepping, and used to record
information to fixup pc after displaced stepping if needed. Some
emit_* functions are converted to macros, and moved to
arch/aarch64-insn.{c,h} so that they can be shared.
gdb:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* aarch64-linux-tdep.c: Include arch-utils.h.
(aarch64_linux_init_abi): Call set_gdbarch_max_insn_length,
set_gdbarch_displaced_step_copy_insn,
set_gdbarch_displaced_step_fixup,
set_gdbarch_displaced_step_free_closure,
set_gdbarch_displaced_step_location,
and set_gdbarch_displaced_step_hw_singlestep.
* aarch64-tdep.c (struct displaced_step_closure): New.
(struct aarch64_displaced_step_data): New.
(aarch64_displaced_step_b): New function.
(aarch64_displaced_step_b_cond): Likewise.
(aarch64_register): Likewise.
(aarch64_displaced_step_cb): Likewise.
(aarch64_displaced_step_tb): Likewise.
(aarch64_displaced_step_adr): Likewise.
(aarch64_displaced_step_ldr_literal): Likewise.
(aarch64_displaced_step_others): Likewise.
(aarch64_displaced_step_copy_insn): Likewise.
(aarch64_displaced_step_fixup): Likewise.
(aarch64_displaced_step_hw_singlestep): Likewise.
* aarch64-tdep.h (DISPLACED_MODIFIED_INSNS): New macro.
(aarch64_displaced_step_copy_insn): Declare.
(aarch64_displaced_step_fixup): Declare.
(aarch64_displaced_step_hw_singlestep): Declare.
* arch/aarch64-insn.c (emit_insn): Moved from
gdbserver/linux-aarch64-low.c.
(emit_load_store): Likewise.
* arch/aarch64-insn.h (enum aarch64_opcodes): Moved from
gdbserver/linux-aarch64-low.c.
(struct aarch64_register): Likewise.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(can_encode_int32): New macro.
(emit_b, emit_bcond, emit_cb, emit_ldr, emit_ldrsw): Likewise.
(emit_tb, emit_nop): Likewise.
(emit_insn): Declare.
(emit_load_store): Declare.
gdb/gdbserver:
2015-10-12 Yao Qi <yao.qi@linaro.org>
* linux-aarch64-low.c (enum aarch64_opcodes): Move to
arch/aarch64-insn.h.
(struct aarch64_memory_operand): Likewise.
(ENCODE): Likewise.
(emit_insn): Move to arch/aarch64-insn.c.
(emit_b, emit_bcond, emit_cb, emit_tb): Remove.
(emit_load_store): Move to arch/aarch64-insn.c.
(emit_ldr, emit_ldrb, emit_ldrsw, emit_nop): Remove.
(can_encode_int32): Remove.
2015-10-12 18:28:38 +08:00
|
|
|
struct displaced_step_closure *
|
|
|
|
aarch64_displaced_step_copy_insn (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR from, CORE_ADDR to,
|
|
|
|
struct regcache *regs);
|
|
|
|
|
|
|
|
void aarch64_displaced_step_fixup (struct gdbarch *gdbarch,
|
|
|
|
struct displaced_step_closure *dsc,
|
|
|
|
CORE_ADDR from, CORE_ADDR to,
|
|
|
|
struct regcache *regs);
|
|
|
|
|
|
|
|
int aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
|
|
|
|
struct displaced_step_closure *closure);
|
|
|
|
|
2013-02-04 20:48:37 +08:00
|
|
|
#endif /* aarch64-tdep.h */
|