From 239535a699ea79647f5fb8cbf968009f831bf794 Mon Sep 17 00:00:00 2001
From: Roland McGrath <roland@gnu.org>
Date: Fri, 3 May 2002 22:53:52 +0000
Subject: 2002-05-01  Roland McGrath  <roland@frob.com>

	* elfcore.c [ALPHA_THREAD_STATE]
	(ELF_MACHINE, fetch_thread_regset, fetch_thread_fpregset):
	New definitions for Alpha CPU.
---
 exec/elfcore.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

(limited to 'exec')

diff --git a/exec/elfcore.c b/exec/elfcore.c
index cb877825..16904a8c 100644
--- a/exec/elfcore.c
+++ b/exec/elfcore.c
@@ -74,6 +74,34 @@ fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
     }
 }
 
+#elif defined ALPHA_THREAD_STATE
+# define ELF_MACHINE		EM_ALPHA
+
+/* The gregset_t format (compatible with Linux/Alpha) almost fits
+   the Mach alpha_thread_state.  */
+static inline void
+fetch_thread_regset (thread_t thread, prgregset_t *gregs)
+{
+  mach_msg_type_number_t count = ALPHA_THREAD_STATE_COUNT;
+  assert (sizeof (struct alpha_thread_state) <= sizeof (prgregset_t));
+  (void) thread_get_state (thread, ALPHA_THREAD_STATE,
+			   (thread_state_t) gregs, &count);
+  /* XXX
+     gregs[32] is process-status word: Mach doesn't return it!
+     It's already zero'd.
+  */
+}
+
+/* The FPU state matches exactly.  */
+static inline void
+fetch_thread_fpregset (thread_t thread, prfpregset_t *fpregs)
+{
+  mach_msg_type_number_t count = ALPHA_FLOAT_STATE_COUNT;
+  assert (sizeof (struct alpha_float_state) == sizeof *fpregs);
+  (void) thread_get_state (thread, ALPHA_FLOAT_STATE,
+			   (thread_state_t) fpregs, &count);
+}
+
 #else
 # warning "do not understand this machine flavor, no registers in dumps"
 # define ELF_MACHINE		EM_NONE
-- 
cgit v1.2.3