bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 08/10] elfcore: Add support for saving AArch64 registers


From: Sergey Bugaev
Subject: [PATCH 08/10] elfcore: Add support for saving AArch64 registers
Date: Sat, 23 Mar 2024 14:53:20 +0300

---
 exec/elfcore.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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
-- 
2.44.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]