aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2024-03-23 14:53:20 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-03-23 13:04:59 +0100
commitbbb662f012ca16c53f93d9de32872a9229c87769 (patch)
tree75fc71995fe54064e081dbd75f268fd6e27dd6c3
parentdb46ea2eb9dc84959fbf9b1819facac3d6078ba1 (diff)
downloadhurd-bbb662f012ca16c53f93d9de32872a9229c87769.tar.gz
hurd-bbb662f012ca16c53f93d9de32872a9229c87769.tar.bz2
hurd-bbb662f012ca16c53f93d9de32872a9229c87769.zip
elfcore: Add support for saving AArch64 registers
Message-ID: <20240323115322.69075-8-bugaevc@gmail.com>
-rw-r--r--exec/elfcore.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/exec/elfcore.c b/exec/elfcore.c
index c6aa2bc8..8c85b13b 100644
--- a/exec/elfcore.c
+++ b/exec/elfcore.c
@@ -187,6 +187,32 @@ fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
(thread_state_t) fpregs, &count);
}
+#elif defined (AARCH64_THREAD_STATE)
+
+# define ELF_MACHINE EM_AARCH64
+
+static inline void
+fetch_thread_regset (thread_t thread, prgregset_t *gregs)
+{
+ mach_msg_type_number_t count = AARCH64_THREAD_STATE_COUNT;
+ _Static_assert (sizeof (prgregset_t) == sizeof (struct aarch64_thread_state),
+ "thread state mismatch");
+ (void) thread_get_state (thread, AARCH64_THREAD_STATE,
+ (thread_state_t) gregs, &count);
+ assert_backtrace (count == AARCH64_THREAD_STATE_COUNT);
+}
+
+static inline void
+fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
+{
+ mach_msg_type_number_t count = AARCH64_FLOAT_STATE_COUNT;
+ _Static_assert (sizeof (prfpregset_t) == sizeof (struct aarch64_float_state),
+ "float state mismatch");
+ (void) thread_get_state (thread, AARCH64_FLOAT_STATE,
+ (thread_state_t) fpregs, &count);
+ assert_backtrace (count == AARCH64_FLOAT_STATE_COUNT);
+}
+
#else
# warning "do not understand this machine flavor, no registers in dumps"
# define ELF_MACHINE EM_NONE