Re: [PATCH v5 12/25] AArch64: Implement memory tagging target methods for AArch64

Simon Marchi via Gdb-patches
2021-02-05T03:31:06Z

> +/* Implement the "supports_memory_tagging" target_ops method. */
> +
> +bool
> +aarch64_linux_nat_target::supports_memory_tagging ()
> +{
> + return (linux_get_hwcap2 (this) & HWCAP2_MTE) != 0;
> +}
> +
> +/* Implement the "fetch_memtags" target_ops method. */
> +
> +bool
> +aarch64_linux_nat_target::fetch_memtags (CORE_ADDR address, size_t len,
> + gdb::byte_vector &tags, int type)
> +{
> + int tid = get_ptrace_pid (inferior_ptid);
> +
> + /* Allocation tags? */
> + if (type == static_cast <int> (aarch64_memtag_type::mte_allocation))
> + return aarch64_mte_fetch_memtags (tid, address, len, tags);

We don't use a space before template parameters, so `static_cast<int>`.

> +
> + return false;
> +}
> +
> +/* Implement the "store_memtags" target_ops method. */
> +
> +bool
> +aarch64_linux_nat_target::store_memtags (CORE_ADDR address, size_t len,
> + const gdb::byte_vector &tags, int type)
> +{
> + int tid = get_ptrace_pid (inferior_ptid);
> +
> + /* Allocation tags? */
> + if (type == static_cast <int> (aarch64_memtag_type::mte_allocation))
> + return aarch64_mte_store_memtags (tid, address, len, tags);

Likewise.

> +
> + return false;
> +}
> +
> /* Define AArch64 maintenance commands. */
>
> static void
> diff --git a/gdb/arch/aarch64-mte-linux.c b/gdb/arch/aarch64-mte-linux.c
> new file mode 100644
> index 0000000000..ede5f5f2b9
> --- /dev/null
> +++ b/gdb/arch/aarch64-mte-linux.c
> @@ -0,0 +1,34 @@
> +/* Common Linux target-dependent functionality for AArch64 MTE
> +
> + Copyright (C) 2020 Free Software Foundation, Inc.

2021, I'll stop mentioning these, please apply to all new files

Otherwise, LGTM.

Simon