• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修订版de52b1c3dd23f6c9a39097fada99f6d55c6b000e (tree)
时间2020-06-16 21:58:32
作者Luis Machado <luis.machado@lina...>
CommiterLuis Machado

Log Message

Add gdbserver memory tagging support

Adds the AArch64-specific memory tagging support (MTE) by implementing the
required hooks and checks.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* Makefile.in (SFILES): Add /../gdb/nat/aarch64-mte-linux-ptrace.c.
* configure.srv (aarch64*-*-linux*): Add arch/aarch64-linux.o and
nat/aarch64-mte-linux-ptrace.o.
* linux-aarch64-low.cc: Include nat/aarch64-mte-linux-ptrace.h.
(class aarch64_target) <supports_memory_tagging>
<fetch_memtags, store_memtags>: New method overrides.
(aarch64_target::supports_memory_tagging)
(aarch64_target::fetch_memtags)
(aarch64_target::store_memtags): New methods.

更改概述

差异

--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -212,6 +212,7 @@ SFILES = \
212212 $(srcdir)/../gdb/arch/ppc-linux-common.c \
213213 $(srcdir)/../gdb/arch/riscv.c \
214214 $(srcdir)/../gdb/nat/aarch64-sve-linux-ptrace.c \
215+ $(srcdir)/../gdb/nat/aarch64-mte-linux-ptrace.c \
215216 $(srcdir)/../gdb/nat/linux-btrace.c \
216217 $(srcdir)/../gdb/nat/linux-namespaces.c \
217218 $(srcdir)/../gdb/nat/linux-osdata.c \
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -52,8 +52,10 @@ case "${gdbserver_host}" in
5252 srv_tgtobj="$srv_tgtobj nat/aarch64-linux.o"
5353 srv_tgtobj="$srv_tgtobj arch/aarch64-insn.o"
5454 srv_tgtobj="$srv_tgtobj arch/aarch64.o"
55+ srv_tgtobj="$srv_tgtobj arch/aarch64-linux.o"
5556 srv_tgtobj="$srv_tgtobj linux-aarch64-tdesc.o"
5657 srv_tgtobj="$srv_tgtobj nat/aarch64-sve-linux-ptrace.o"
58+ srv_tgtobj="$srv_tgtobj nat/aarch64-mte-linux-ptrace.o"
5759 srv_tgtobj="${srv_tgtobj} $srv_linux_obj"
5860 srv_linux_regsets=yes
5961 srv_linux_thread_db=yes
--- a/gdbserver/linux-aarch64-low.cc
+++ b/gdbserver/linux-aarch64-low.cc
@@ -44,6 +44,7 @@
4444 #include "linux-aarch32-tdesc.h"
4545 #include "linux-aarch64-tdesc.h"
4646 #include "nat/aarch64-sve-linux-ptrace.h"
47+#include "nat/aarch64-mte-linux-ptrace.h"
4748 #include "tdesc.h"
4849
4950 #ifdef HAVE_SYS_REG_H
@@ -82,6 +83,14 @@ public:
8283
8384 struct emit_ops *emit_ops () override;
8485
86+ bool supports_memory_tagging () override;
87+
88+ int fetch_memtags (CORE_ADDR address, size_t len,
89+ gdb::byte_vector &tags) override;
90+
91+ int store_memtags (CORE_ADDR address, size_t len,
92+ const gdb::byte_vector &tags) override;
93+
8594 protected:
8695
8796 void low_arch_setup () override;
@@ -3193,6 +3202,36 @@ aarch64_target::breakpoint_kind_from_current_state (CORE_ADDR *pcptr)
31933202 return arm_breakpoint_kind_from_current_state (pcptr);
31943203 }
31953204
3205+/* Returns true if memory tagging is supported. */
3206+bool
3207+aarch64_target::supports_memory_tagging ()
3208+{
3209+ if (current_thread == NULL)
3210+ return false;
3211+
3212+ return (linux_get_hwcap2 (8) & HWCAP2_MTE) != 0;
3213+}
3214+
3215+int
3216+aarch64_target::fetch_memtags (CORE_ADDR address, size_t len,
3217+ gdb::byte_vector &tags)
3218+{
3219+ /* Allocation tags are per-process, so any tid is fine. */
3220+ int tid = lwpid_of (current_thread);
3221+
3222+ return aarch64_mte_fetch_memtags (tid, address, len, tags);
3223+}
3224+
3225+int
3226+aarch64_target::store_memtags (CORE_ADDR address, size_t len,
3227+ const gdb::byte_vector &tags)
3228+{
3229+ /* Allocation tags are per-process, so any tid is fine. */
3230+ int tid = lwpid_of (current_thread);
3231+
3232+ return aarch64_mte_store_memtags (tid, address, len, tags);
3233+}
3234+
31963235 /* The linux target ops object. */
31973236
31983237 linux_process_target *the_linux_target = &the_aarch64_target;