[kaffe] netbsd/ppc patches

Riccardo Mottola zuse at libero.it
Sun Jul 3 08:19:21 PDT 2005


Hello,

the accluded patch tries to use netbsd macros to access stack and frame 
data instead of "homebrew" stuff. I verified that it didn't break 
anything on netbsd/ppc. Unfortunately the same approach still fails on 
other platforms and I must investigate. I hope in the long run that this 
approach can be cleaned up and spread among different netbsd's.

The patch also contains some initial work for JIT on netbsd/ppc.

cheers,
    Riccardo

-------------- next part --------------
? stack_patches.diff
? config/powerpc/netbsd1/jit3-md.h
? libltdl/config-h.in]
Index: config/powerpc/linux/md.h
===================================================================
RCS file: /cvs/kaffe/kaffe/config/powerpc/linux/md.h,v
retrieving revision 1.12
diff -u -r1.12 md.h
--- config/powerpc/linux/md.h	21 Dec 2004 00:15:29 -0000	1.12
+++ config/powerpc/linux/md.h	3 Jul 2005 14:46:06 -0000
@@ -2,9 +2,12 @@
  * powerpc/linux/md.h
  * Linux PowerPC configuration information.
  *
- * Copyright (c) 1996, 1997, 2004
+ * Copyright (c) 1996, 1997
  *	Transvirtual Technologies, Inc.  All rights reserved.
  *
+ * Copyright (c) 2004
+ *      The kaffe.org's developers. See ChangeLog for details.
+ *
  * See the file "license.terms" for information on usage and redistribution 
  * of this file. 
  */
@@ -59,7 +62,7 @@
 #if defined(__GLIBC__)
 #define KAFFEMD_STACKEND
 extern void *mdGetStackEnd(void);
-#endif
+#endif /* __GLIBC__ */
 
 
 #endif
Index: config/powerpc/netbsd1/md.h
===================================================================
RCS file: /cvs/kaffe/kaffe/config/powerpc/netbsd1/md.h,v
retrieving revision 1.4
diff -u -r1.4 md.h
--- config/powerpc/netbsd1/md.h	27 Oct 2004 17:23:24 -0000	1.4
+++ config/powerpc/netbsd1/md.h	3 Jul 2005 14:46:06 -0000
@@ -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.
  */
@@ -15,6 +18,8 @@
 #include "powerpc/common.h"
 #include "powerpc/threads.h"
 
+#include <signal.h>
+
 #if (__GNUC__ == 2 && __GNUC_MINOR__ == 91)
 /* egcs-1.1.2 aka gcc-2.91 can't compile locks.c with "cc" constraint */
 extern int __egcs_cmpxchg(void **A, void *O, void *N);
@@ -22,7 +27,7 @@
 #undef COMPARE_AND_EXCHANGE
 #define COMPARE_AND_EXCHANGE(A,O,N)		\
 	__egcs_cmpxchg((void**)(A), (void*)(O), (void*)(N))
-#endif
+#endif /* ecgs 1.1.2 - gcc 2.91 */
 
 
 #if defined(JTHREAD_JBLEN) && (JTHREAD_JBLEN > 0)
@@ -36,7 +41,7 @@
 #define JTHREAD_SETJMP(jb)		kaffe_setjmp(jb)
 #define JTHREAD_LONGJMP(jb, val)	kaffe_longjmp(jb, val)
 
-#else
+#else /* JTHREAD_JBLEN && JTHREAD_JBLEN > 0 */
 
 #undef SP_OFFSET
 #define SP_OFFSET	3
@@ -44,13 +49,38 @@
 /* JTHREAD_JMPBUFF can't be redefined here as it may be already use in
    structure vmException */
 
-#endif
+#endif /* jthread_jblen */
 
-#define SIGNAL_ARGS(sig, sc) int sig
+#define SIGCONTEXT struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS
+// #define GET_FRAME(ctx)	(*(void **)((ctx)->regs->gpr[1])) /* this is wrong */
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+#ifdef SA_SIGINFO
+#include <sys/ucontext.h>
+#include <machine/mcontext.h>
+#define SIGNAL_ARGS(sig, sc) int sig, siginfo_t *__si, void *sc
+#define SIGNAL_CONTEXT_POINTER(scp) ucontext_t *scp
+#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
+#define SIGNAL_PC(scp) _UC_MACHINE_PC(((ucontext_t *)(scp)))
+#else
+/* this is incomplete anyway */
+#define SIGNAL_ARGS(sig, scp) int sig, struct sigcontext *scp
+#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
+#define GET_SIGNAL_CONTEXT_POINTER(scp) (scp)
+#endif /* SA_SIGINFO */
 #undef HAVE_SIGALTSTACK
 
+
+
+#include "kaffe-unix-stack.h"
+
 /* align data types to their size */
 #define   ALIGNMENT_OF_SIZE(S)    (S)
 
 
-#endif
+
+
+
+#endif /* include guard */


More information about the kaffe mailing list