[kaffe] CVS kaffe (robilad): Fixes and cleanups for powerpc support
and start of a jitter for powerpc-netbsd
Kaffe CVS
cvs-commits at kaffe.org
Sun Jul 3 18:19:52 PDT 2005
PatchSet 6693
Date: 2005/07/04 01:12:32
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Fixes and cleanups for powerpc support and start of a jitter for powerpc-netbsd
2005-07-04 Riccardo Mottola <rmottola at users.sf.net>
* config/powerpc/netbsd1/jit3-md.h
Added to start JIT support
* config/powerpc/darwin/jit3-md.h
A small comment added
* config/powerpc/linux/md.h,
config/powerpc/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.
First patches to get JIT ported to powerpc-netbsd2.
Members:
ChangeLog:1.4217->1.4218
config/Makefile.am:1.60->1.61
config/Makefile.in:1.184->1.185
config/powerpc/darwin/jit3-md.h:1.2->1.3
config/powerpc/linux/md.h:INITIAL->1.13
config/powerpc/netbsd1/jit3-md.h:INITIAL->1.1
config/powerpc/netbsd1/md.h:INITIAL->1.5
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4217 kaffe/ChangeLog:1.4218
--- kaffe/ChangeLog:1.4217 Mon Jul 4 00:53:11 2005
+++ kaffe/ChangeLog Mon Jul 4 01:12:32 2005
@@ -1,5 +1,20 @@
2005-07-04 Riccardo Mottola <rmottola at users.sf.net>
+ * config/powerpc/netbsd1/jit3-md.h
+ Added to start JIT support
+
+ * config/powerpc/darwin/jit3-md.h
+ A small comment added
+
+ * config/powerpc/linux/md.h,
+ config/powerpc/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.
+ First patches to get JIT ported to powerpc-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.
Index: kaffe/config/Makefile.am
diff -u kaffe/config/Makefile.am:1.60 kaffe/config/Makefile.am:1.61
--- kaffe/config/Makefile.am:1.60 Mon May 23 10:43:40 2005
+++ kaffe/config/Makefile.am Mon Jul 4 01:12:38 2005
@@ -316,6 +316,7 @@
powerpc/netbsd1/config.frag \
powerpc/netbsd1/md.c \
powerpc/netbsd1/md.h \
+ powerpc/netbsd1/jit3-md.h \
powerpc/callmethod_ppc.h \
powerpc/jit.h \
powerpc/jit3-icode.h \
Index: kaffe/config/Makefile.in
diff -u kaffe/config/Makefile.in:1.184 kaffe/config/Makefile.in:1.185
--- kaffe/config/Makefile.in:1.184 Mon May 23 10:43:40 2005
+++ kaffe/config/Makefile.in Mon Jul 4 01:12:38 2005
@@ -658,6 +658,7 @@
powerpc/netbsd1/config.frag \
powerpc/netbsd1/md.c \
powerpc/netbsd1/md.h \
+ powerpc/netbsd1/jit3-md.h \
powerpc/callmethod_ppc.h \
powerpc/jit.h \
powerpc/jit3-icode.h \
Index: kaffe/config/powerpc/darwin/jit3-md.h
diff -u kaffe/config/powerpc/darwin/jit3-md.h:1.2 kaffe/config/powerpc/darwin/jit3-md.h:1.3
--- kaffe/config/powerpc/darwin/jit3-md.h:1.2 Tue Dec 21 00:15:28 2004
+++ kaffe/config/powerpc/darwin/jit3-md.h Mon Jul 4 01:12:39 2005
@@ -8,6 +8,9 @@
/*
* Initialize the exceptionFrame object "f" with the stack frame captured in
* the given sigcontext structure.
+ *
+ * from ppc/signal.h sigcontext definition:
+ void *sc_regs; /* (kernel private) saved state */
*/
#define EXCEPTIONFRAME(f, c) \
do { \
===================================================================
Checking out kaffe/config/powerpc/linux/md.h
RCS: /home/cvs/kaffe/kaffe/config/powerpc/linux/md.h,v
VERS: 1.13
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/config/powerpc/linux/md.h Mon Jul 4 01:19:52 2005
@@ -0,0 +1,68 @@
+/*
+ * powerpc/linux/md.h
+ * Linux PowerPC configuration information.
+ *
+ * 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.
+ */
+
+#ifndef __powerpc_linux_md_h
+#define __powerpc_linux_md_h
+
+#include "powerpc/common.h"
+#include "powerpc/threads.h"
+
+#if defined(HAVE_SYS_RESOURCE_H)
+#include <sys/resource.h>
+#endif
+#if defined(HAVE_SIGNAL_H)
+#include <signal.h>
+#endif
+#if defined(HAVE_ASM_SIGCONTEXT_H) && !defined(__GLIBC__)
+#include <asm/sigcontext.h>
+#endif
+
+/*
+ * We don't need a SA_SIGINFO flag to get a proper
+ * sigcontext pointer in a signal handlers.
+ */
+#if defined(SA_SIGINFO)
+#undef SA_SIGINFO
+#endif
+
+/* Linux requires a little initialisation */
+extern void init_md(void);
+#define INIT_MD() init_md()
+
+#ifdef SP_OFFSET
+#undef SP_OFFSET
+#endif
+#define SP_OFFSET 0
+
+#include "sigcontextinfo.h"
+
+#define SIGNAL_ARGS(sig, sc) int sig, struct sigcontext *sc
+#define SIGNAL_CONTEXT_POINTER(scp) struct sigcontext *scp
+#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
+#define SIGNAL_PC(scp) (GET_PC(scp))
+#define STACK_POINTER(scp) (GET_STACK(scp))
+#undef HAVE_SIGALTSTACK
+
+#include "kaffe-unix-stack.h"
+
+/* align data types to their size */
+#define ALIGNMENT_OF_SIZE(S) (S)
+
+#if defined(__GLIBC__)
+#define KAFFEMD_STACKEND
+extern void *mdGetStackEnd(void);
+#endif /* __GLIBC__ */
+
+
+#endif
===================================================================
Checking out kaffe/config/powerpc/netbsd1/jit3-md.h
RCS: /home/cvs/kaffe/kaffe/config/powerpc/netbsd1/jit3-md.h,v
VERS: 1.1
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/config/powerpc/netbsd1/jit3-md.h Mon Jul 4 01:19:52 2005
@@ -0,0 +1,73 @@
+/*
+ * jit-3-md.h
+ * Jit definitions for powerpc on netbsd
+ *
+ * Copyright (c) 2004-2005
+ * The kaffe.org's developers. See ChangeLog for details.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+
+#ifndef __powerpc_netbsd_jit3_md_h
+#define __powerpc_netbsd_jit3_md_h
+
+/* mcontext.h gives us macros to access ucontext/mcontext */
+#include <machine/mcontext.h>
+
+#include "config.h"
+#include "powerpc/jit.h"
+
+/*
+ * Initialize the exceptionFrame object "f" with the stack frame captured in
+ * the given sigcontext structure.
+ */
+
+#define EXCEPTIONFRAME(f, c) \
+do { \
+ (f).sp = (ppc_stack_frame_t *)((register_storage_t *)c->sc_regs)[3]; \
+} while( 0 )
+
+
+/*
+#define EXCEPTIONFRAME(f, c) \
+ (f).retbp = _UC_MACHINE_SP(((ucontext_t *)(c))); \
+ (f).retpc = _UC_MACHINE_PC(((ucontext_t *)(c)))
+*/
+
+/*
+ * Flush newly generated instructions from the data cache and invalidate the
+ * same blocks in the instruction cache.
+ *
+ * See section 5.2.5.2 of the PowerPC Programming Environments manual and
+ * numerous usenet discussions on google.
+ *
+ * code_start - The start of the code, no special alignment required.
+ * code_end - The end of the code.
+ */
+#define FLUSH_DCACHE linux_flush_cache
+static inline void linux_flush_cache(void *code_start, void *code_end)
+{
+ /*
+ * The size of a block in the cache, we need to align the flushed
+ * addresses to these blocks.
+ */
+ static int cache_block_size = 32; // bytes
+ uintp curr, last;
+
+ curr = (uintp)code_start;
+ last = (uintp)code_end;
+ curr = (curr - cache_block_size) & ~(cache_block_size - 1);
+ last = (last + cache_block_size) & ~(cache_block_size - 1);
+ for( ; curr < last; curr += cache_block_size )
+ {
+ asm("dcbst 0, %0\n"
+ "sync\n"
+ "icbi 0, %0\n"
+ "sync\n"
+ "isync\n" : : "r" (curr));
+ }
+}
+
+#endif
===================================================================
Checking out kaffe/config/powerpc/netbsd1/md.h
RCS: /home/cvs/kaffe/kaffe/config/powerpc/netbsd1/md.h,v
VERS: 1.5
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/config/powerpc/netbsd1/md.h Mon Jul 4 01:19:52 2005
@@ -0,0 +1,84 @@
+/*
+ * powerpc/netbsd1/md.h
+ * NetBSD PowerPC configuration information.
+ *
+ * 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.
+ */
+
+#ifndef __powerpc_netbsd1_md_h
+#define __powerpc_netbsd1_md_h
+
+#include "powerpc/common.h"
+#include "powerpc/threads.h"
+
+#include <signal.h>
+
+#include <sys/ucontext.h>
+#include <machine/mcontext.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_R1])
+#endif
+#ifdef _UC_MACHINE_PC
+#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_PC])
+#endif
+
+#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);
+
+#undef COMPARE_AND_EXCHANGE
+#define COMPARE_AND_EXCHANGE(A,O,N) \
+ __egcs_cmpxchg((void**)(A), (void*)(O), (void*)(N))
+#endif /* ecgs 1.1.2 - gcc 2.91 */
+
+
+#if defined(JTHREAD_JBLEN) && (JTHREAD_JBLEN > 0)
+
+#undef SP_OFFSET
+#define SP_OFFSET 0
+
+extern void kaffe_longjmp (void *jb, int);
+extern int kaffe_setjmp (void *jb);
+
+#define JTHREAD_SETJMP(jb) kaffe_setjmp(jb)
+#define JTHREAD_LONGJMP(jb, val) kaffe_longjmp(jb, val)
+
+#else /* JTHREAD_JBLEN && JTHREAD_JBLEN > 0 */
+
+#undef SP_OFFSET
+#define SP_OFFSET 3
+
+/* JTHREAD_JMPBUFF can't be redefined here as it may be already use in
+ structure vmException */
+
+#endif /* jthread_jblen */
+
+#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)))
+
+#undef HAVE_SIGALTSTACK
+
+
+
+#include "kaffe-unix-stack.h"
+
+/* align data types to their size */
+#define ALIGNMENT_OF_SIZE(S) (S)
+
+
+
+#endif /* include guard */
More information about the kaffe
mailing list