]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add PTRACE_POKECAP request and move things to a Morello-specific file
authorLuis Machado <luis.machado@linaro.org>
Tue, 5 Jan 2021 21:02:32 +0000 (18:02 -0300)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:53:23 +0000 (15:53 -0700)
gdb/ChangeLog:

2021-01-15  Luis Machado  <luis.machado@arm.com>

* Makefile.in (HFILES_NO_SRCDIR): Add nat/aarch64-cap-linux.h.
* aarch64-linux-nat.c: Include nat/aarch64-cap-linux.h.
* nat/aarch64-cap-linux.h: New file.
* nat/aarch64-linux.h (struct user_morello_state): Move to
nat/aarch64-cap-linux.h.

gdbserver/ChangeLog:

2021-01-15  Luis Machado  <luis.machado@arm.com>

* linux-aarch64-low.cc: Include nat/aarch64-cap-linux.h.

gdb/Makefile.in
gdb/aarch64-linux-nat.c
gdb/nat/aarch64-cap-linux.h [new file with mode: 0644]
gdb/nat/aarch64-linux.h
gdbserver/linux-aarch64-low.cc

index dd83e9bcad79d106f1dd863c5c1c9b0569f3b0b7..d33365b10328633bdd4e30d6412149de49949cde 100644 (file)
@@ -1528,6 +1528,7 @@ HFILES_NO_SRCDIR = \
        mi/mi-main.h \
        mi/mi-out.h \
        mi/mi-parse.h \
+       nat/aarch64-cap-linux.h \
        nat/aarch64-linux.h \
        nat/aarch64-linux-hw-point.h \
        nat/aarch64-mte-linux-ptrace.h \
index 5a79dd444938feb771a31845c4f20d04efd3b92b..5a5ebcc96e8c18de4c0da6f4d0bed14139620312 100644 (file)
@@ -34,6 +34,7 @@
 #include "aarch32-tdep.h"
 #include "arch/arm.h"
 #include "arch/aarch64-cap-linux.h"
+#include "nat/aarch64-cap-linux.h"  /* For Morello */
 #include "nat/aarch64-linux.h"
 #include "nat/aarch64-linux-hw-point.h"
 #include "nat/aarch64-sve-linux-ptrace.h"
diff --git a/gdb/nat/aarch64-cap-linux.h b/gdb/nat/aarch64-cap-linux.h
new file mode 100644 (file)
index 0000000..2b3c1dc
--- /dev/null
@@ -0,0 +1,61 @@
+/* Copyright (C) 2021 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/>.  */
+
+#ifndef NAT_AARCH64_CAP_LINUX_H
+#define NAT_AARCH64_CAP_LINUX_H
+
+/* Morello-specific requests.  */
+#ifndef PTRACE_PEEKCAP
+#define PTRACE_PEEKCAP 12
+#endif
+
+#ifndef PTRACE_POKECAP
+#define PTRACE_POKECAP 13
+#endif
+
+/* Struct defining the layout of the capability register set.  */
+struct user_morello_state {
+       /* General capability registers.  */
+       unsigned __int128 cregs[31];
+       /* Capability program counter.  */
+       unsigned __int128 pcc;
+       /* Capability stack pointer.  */
+       unsigned __int128 csp;
+       /* Default data capability.  */
+       unsigned __int128 ddc;
+       unsigned __int128 ctpidr;
+       unsigned __int128 rcsp;
+       unsigned __int128 rddc;
+       unsigned __int128 rctpidr;
+       /* Compartment ID register.  */
+       unsigned __int128 cid;
+       /* Bitmap storing the tags of all the capability registers.
+          The tag for register <reg> is stored at bit index
+          MORELLO_PT_TAG_MAP_REG_BIT(<reg>) in tag_map.  */
+       uint64_t        tag_map;
+       /* Capability control register.  */
+       uint64_t        cctlr;
+};
+
+/* Struct used to read/write capabilities using ptrace.  */
+struct user_cap {
+  unsigned __int128 val;
+  uint8_t tag;
+  uint8_t __reserved[15];
+};
+
+#endif /* NAT_AARCH64_CAP_LINUX_H */
index 6104dfa8ef2f57aafd63c4f32a1ab3400dda179d..1777ce3252231f4eebfa3fbe7e17cd61a0458a41 100644 (file)
 /* Defines ps_err_e, struct ps_prochandle.  */
 #include "gdb_proc_service.h"
 
-/* Struct defining the layout of the capability register set.  */
-struct user_morello_state {
-       /* General capability registers.  */
-       unsigned __int128 cregs[31];
-       /* Capability program counter.  */
-       unsigned __int128 pcc;
-       /* Capability stack pointer.  */
-       unsigned __int128 csp;
-       /* Default data capability.  */
-       unsigned __int128 ddc;
-       unsigned __int128 ctpidr;
-       unsigned __int128 rcsp;
-       unsigned __int128 rddc;
-       unsigned __int128 rctpidr;
-       /* Compartment ID register.  */
-       unsigned __int128 cid;
-       /* Bitmap storing the tags of all the capability registers.
-          The tag for register <reg> is stored at bit index
-          MORELLO_PT_TAG_MAP_REG_BIT(<reg>) in tag_map.  */
-       uint64_t        tag_map;
-       /* Capability control register.  */
-       uint64_t        cctlr;
-};
-
 typedef int compat_int_t;
 typedef unsigned int compat_uptr_t;
 
index 48e0a3726f8a8eaafcfe51b8f25195525f551a28..78c57b031e370d4ca3901ef1f6d01b7ed1f90033 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "server.h"
 #include "linux-low.h"
+#include "nat/aarch64-cap-linux.h" /* For Morello  */
 #include "nat/aarch64-linux.h"
 #include "nat/aarch64-linux-hw-point.h"
 #include "arch/aarch64-cap-linux.h"