[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
- [PATCH 01/10] term: Fix function prototype, Sergey Bugaev, 2024/03/23
- [PATCH 02/10] exec: Fix creating executable stacks, Sergey Bugaev, 2024/03/23
- [PATCH 04/10] proc: Only try host_kernel_version () on i386, Sergey Bugaev, 2024/03/23
- [PATCH 05/10] libshouldbeinlibc: Stop relying on address space size, Sergey Bugaev, 2024/03/23
- [PATCH 03/10] Make long & friends 64-bit on 64-bit platforms, Sergey Bugaev, 2024/03/23
- [PATCH 06/10] exec: Stop relying on address space size, Sergey Bugaev, 2024/03/23
- [PATCH 09/10] proc: Add support for AArch64 in uname, Sergey Bugaev, 2024/03/23
- [PATCH 07/10] exec: Add support for AArch64 executables, Sergey Bugaev, 2024/03/23
- [PATCH 10/10] boot: Add support for AArch64, Sergey Bugaev, 2024/03/23
- [PATCH 08/10] elfcore: Add support for saving AArch64 registers,
Sergey Bugaev <=
- Re: [PATCH 01/10] term: Fix function prototype, Samuel Thibault, 2024/03/23