[kaffe] CVS kaffe (robilad): Fixes for accessor macros on i386-netbsd2

Kaffe CVS cvs-commits at kaffe.org
Sun Jul 3 18:08:07 PDT 2005


PatchSet 6692 
Date: 2005/07/04 00:53:11
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Fixes for accessor macros on i386-netbsd2

2005-07-04  Riccardo Mottola  <rmottola at users.sf.net>

        * config/i386/netbsd1/jit-md.h,
        config/i386/netbsd1/md.h:
        Changed macros to use ucontext_t instead of sigcontext.
        Also unified them to use macros provided by netbsd that
        are portable among different platforms to get SP and PC.

Members: 
	ChangeLog:1.4216->1.4217 
	config/i386/netbsd1/jit-md.h:1.2->1.3 
	config/i386/netbsd1/md.h:1.10->1.11 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4216 kaffe/ChangeLog:1.4217
--- kaffe/ChangeLog:1.4216	Mon Jul  4 00:41:36 2005
+++ kaffe/ChangeLog	Mon Jul  4 00:53:11 2005
@@ -1,5 +1,13 @@
 2005-07-04  Riccardo Mottola  <rmottola at users.sf.net>
 
+	*config/i386/netbsd1/jit-md.h,
+	config/i386/netbsd1/md.h:
+	Changed macros to use ucontext_t instead of sigcontext.
+	Also unified them to use macros provided by netbsd that 
+	are portable among different platforms to get SP and PC.
+
+2005-07-04  Riccardo Mottola  <rmottola at users.sf.net>
+
 	* config/sparc/netbsd1/jit-md.h, 
 	config/sparc/netbsd1/md.h:
 	Changed macros to use ucontext_t instead of sigcontext. 
Index: kaffe/config/i386/netbsd1/jit-md.h
diff -u kaffe/config/i386/netbsd1/jit-md.h:1.2 kaffe/config/i386/netbsd1/jit-md.h:1.3
--- kaffe/config/i386/netbsd1/jit-md.h:1.2	Wed Aug 27 07:04:21 2003
+++ kaffe/config/i386/netbsd1/jit-md.h	Mon Jul  4 00:53:16 2005
@@ -26,7 +26,8 @@
 
 /* Get the first exception frame from a signal handler */
 #define	EXCEPTIONFRAME(f, c)						\
-	(f).retbp = (c)->sc_ebp;					\
-	(f).retpc = (c)->sc_eip + 1
+        (f).retbp = _UC_MACHINE_SP(((ucontext_t *)(c)));                \
+	(f).retpc = _UC_MACHINE_PC(((ucontext_t *)(c)))
+
 
 #endif
Index: kaffe/config/i386/netbsd1/md.h
diff -u kaffe/config/i386/netbsd1/md.h:1.10 kaffe/config/i386/netbsd1/md.h:1.11
--- kaffe/config/i386/netbsd1/md.h:1.10	Sun Apr 24 13:46:08 2005
+++ kaffe/config/i386/netbsd1/md.h	Mon Jul  4 00:53:16 2005
@@ -18,6 +18,9 @@
 #include "i386/common.h"
 #include "i386/threads.h"
 
+#if defined(HAVE_SIGNAL_H)
+#include <signal.h>
+#endif
 #if defined(HAVE_SYS_RESOURCE_H)
 #include <sys/resource.h>
 #endif
@@ -28,17 +31,31 @@
 #include <unistd.h>
 #endif
 
+
+#include <sys/ucontext.h>
+
+/* older netbsd's could have this macro missing, so we provide it */
+#ifdef _UC_MACHINE_SP
+#define _UC_MACHINE_SP(uc)      ((uc)->uc_mcontext.__gregs[_REG_UESP])
+#endif
+#ifdef _UC_MACHINE_PC
+#define _UC_MACHINE_PC(uc)      ((uc)->uc_mcontext.__gregs[_REG_EIP])
+#endif
+
+
 /*
  * Redefine stack pointer offset.
  */
 #undef SP_OFFSET
 #define SP_OFFSET 2
 
-#define SIGNAL_ARGS(sig, sc) int sig, int __code, struct sigcontext *sc
-#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
+#define SIGCONTEXT ucontext_t
+
+#define SIGNAL_ARGS(sig, sc) int sig, siginfo_t *__si, void *sc
+#define SIGNAL_CONTEXT_POINTER(scp) SIGCONTEXT *scp
 #define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
-#define SIGNAL_PC(scp) (scp)->sc_pc
-#define STACK_POINTER(scp) (scp)->sc_sp
+#define SIGNAL_PC(scp) _UC_MACHINE_PC(((SIGCONTEXT *)(scp)))
+#define STACK_POINTER(scp) _UC_MACHINE_SP(((SIGCONTEXT *)(scp)))
 
 #if defined(TRANSLATOR)
 #include "jit-md.h"




More information about the kaffe mailing list