]> 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)
committerLuis Machado <luis.machado@linaro.org>
Fri, 15 Jan 2021 21:55:37 +0000 (18:55 -0300)
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/ChangeLog
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/ChangeLog
gdbserver/linux-aarch64-low.cc

index 22beb9b8a6a825c541af6da235ecd168d7924ca0..760765b6ff3145e388fcfea4dd32ef32ff6bb755 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2021-01-15  Luis Machado  <luis.machado@arm.com>
 
        * arch/aarch64-cap-linux.h: Fix define name.
index c741ab2853ad81b36c92c11c9360f3aaf56bc848..48c27aaac39fedf5d6a44cdd4cda6ce182e74dbb 100644 (file)
@@ -1492,6 +1492,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-sve-linux-ptrace.h \
index d1859c89da40338675cd2abc40d72b97200681ce..91130520db8e07530cc1889deefb94093b251b6b 100644 (file)
@@ -33,6 +33,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 3ac3ac350f474a36066fe53fa3d906febeed85fb..3c4481a978da4684360424b30dc8debc593ca33d 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 a0b901b23dde624b2f7a9243e08fcded57c836e0..e4bccab0cd03ab78b7bcb8fde02f5fc418e31df9 100644 (file)
@@ -1,3 +1,7 @@
+2021-01-15  Luis Machado  <luis.machado@arm.com>
+
+       * linux-aarch64-low.cc: Include nat/aarch64-cap-linux.h.
+
 2020-11-11  Luis Machado  <luis.machado@arm.com>
 
        * linux-aarch64-low.cc (aarch64_store_cregset): Invert pcc/csp.
index d034e783cb23a0dbd44e746c990916e2d7990117..4fe7e536d18b54e6a91eee91b225bbb1bb6658fe 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"