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

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


PatchSet 6691 
Date: 2005/07/04 00:41:36
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Fixes for accessor macros on sparc-netbsd2

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.
        Also unified them to use macros provided by netbsd that
        are portable among different platforms to get SP and PC.

Members: 
	ChangeLog:1.4215->1.4216 
	config/sparc/netbsd1/jit-md.h:1.2->1.3 
	config/sparc/netbsd1/md.h:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4215 kaffe/ChangeLog:1.4216
--- kaffe/ChangeLog:1.4215	Mon Jul  4 00:03:33 2005
+++ kaffe/ChangeLog	Mon Jul  4 00:41:36 2005
@@ -1,3 +1,11 @@
+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. 
+	Also unified them to use macros provided by netbsd that 
+	are portable among different platforms to get SP and PC.
+
 2005-07-03  Dalibor Topic  <robilad at kaffe.org>
 
 	Updated the address of the FSF in the GPL,
Index: kaffe/config/sparc/netbsd1/jit-md.h
diff -u kaffe/config/sparc/netbsd1/jit-md.h:1.2 kaffe/config/sparc/netbsd1/jit-md.h:1.3
--- kaffe/config/sparc/netbsd1/jit-md.h:1.2	Sun Mar 21 21:54:01 2004
+++ kaffe/config/sparc/netbsd1/jit-md.h	Mon Jul  4 00:41:41 2005
@@ -5,6 +5,9 @@
  * Copyright (c) 1996, 1997
  *	Transvirtual Technologies, Inc.  All rights reserved.
  *
+ * Copyright (c) 2005
+ *      The kaffe.org's developers. See ChangeLog for details.
+ *
  * See the file "license.terms" for information on usage and redistribution 
  * of this file. 
  */
@@ -12,6 +15,9 @@
 #ifndef __sparc_netbsd_jit_md_h
 #define __sparc_netbsd_jit_md_h
 
+/* mcontext.h gives us macros to access ucontext/mcontext */
+#include <sys/ucontext.h>
+
 /**/
 /* Include common information. */
 /**/
@@ -23,11 +29,13 @@
 
 /* Function prototype for signal handlers */
 #define EXCEPTIONPROTO                                                  \
-        int sig, int code, struct sigcontext* ctx
+        int sig, int code, ucontext_t* ctx
 
 /* Get the first exception frame from a signal handler */
 #define EXCEPTIONFRAME(f, c)                                            \
-        (f).retbp = (c)->sc_sp;                                         \
-        (f).retpc = (c)->sc_pc
+        (f).retbp = _UC_MACHINE_SP(((ucontext_t *)(c)));                \
+        (f).retpc = _UC_MACHINE_PC(((ucontext_t *)(c)))
+
+
 
-#endif
+#endif /* include guard */
Index: kaffe/config/sparc/netbsd1/md.h
diff -u kaffe/config/sparc/netbsd1/md.h:1.5 kaffe/config/sparc/netbsd1/md.h:1.6
--- kaffe/config/sparc/netbsd1/md.h:1.5	Mon Jun 27 12:01:27 2005
+++ kaffe/config/sparc/netbsd1/md.h	Mon Jul  4 00:41:41 2005
@@ -12,15 +12,29 @@
 #ifndef __sparc_netbsd1_md_h
 #define __sparc_netbsd1_md_h
 
+#include <signal.h>
+
 #include "sparc/common.h"
 #include "sparc/threads.h"
 
-#undef SA_SIGINFO
-#define SIGNAL_ARGS(sig, sc) int sig, int code, struct sigcontext* sc
-#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext* scp
-#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
-#define SIGNAL_PC(scp) ((scp)->sc_pc)
-#define STACK_POINTER(scp) ((scp)->sc_sp)
+#include <sys/ucontext.h>
+
+/* older netbsd's could have this macro missing, so we provide it */
+#ifdef _UC_MACHINE_SP
+/* this is for 32bit it doesn't take in account 64bit */
+#define _UC_MACHINE_SP(uc)      ((uc)->uc_mcontext.__gregs[_REG_O6])
+#endif
+#ifdef _UC_MACHINE_PC
+#define _UC_MACHINE_PC(uc)      ((uc)->uc_mcontext.__gregs[_REG_PC])
+#endif
+
+#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) _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