[kaffe] CVS kaffe (robilad): Added port to GNU/kFreeBSD
Kaffe CVS
cvs-commits at kaffe.org
Thu Nov 16 15:26:54 PST 2006
PatchSet 7443
Date: 2006/11/16 23:26:03
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Added port to GNU/kFreeBSD
2006-11-17 Petr Salinger <Petr.Salinger at seznam.cz>
Added port to GNU/kFreeBSD.
* config/config.alias: Added kfreebsd.
* kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:
(SCHEDULE_POLICY) Leave undefined for GNU/kFreeBSD.
* config/i386/freebsd2/md.h: Add a little initialisation
code for GNU/kFreeBSD.
* kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:
Set SP_OFFSET for GNU/kFreeBSD.
Members:
ChangeLog:1.4943->1.4944
config/config.alias:1.26->1.27
config/i386/freebsd2/md.h:INITIAL->1.17
kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:INITIAL->1.13
kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.93->1.94
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4943 kaffe/ChangeLog:1.4944
--- kaffe/ChangeLog:1.4943 Sun Nov 12 13:45:04 2006
+++ kaffe/ChangeLog Thu Nov 16 23:26:03 2006
@@ -1,3 +1,18 @@
+2006-11-17 Petr Salinger <Petr.Salinger at seznam.cz>
+
+ Added port to GNU/kFreeBSD.
+
+ * config/config.alias: Added kfreebsd.
+
+ * kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:
+ (SCHEDULE_POLICY) Leave undefined for GNU/kFreeBSD.
+
+ * config/i386/freebsd2/md.h: Add a little initialisation
+ code for GNU/kFreeBSD.
+
+ * kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h:
+ Set SP_OFFSET for GNU/kFreeBSD.
+
2006-11-12 Alexander Boettcher <alex at kaffe.org>
* config/i386/drops/config.frag,
Index: kaffe/config/config.alias
diff -u kaffe/config/config.alias:1.26 kaffe/config/config.alias:1.27
--- kaffe/config/config.alias:1.26 Tue Jun 6 02:10:23 2006
+++ kaffe/config/config.alias Thu Nov 16 23:26:03 2006
@@ -31,6 +31,7 @@
cygwin*) Khost_os=cygwin32 ;;
darwin*) Khost_os=darwin ;;
freebsd*) Khost_os=freebsd2 ;;
+kfreebsd*) Khost_os=freebsd2 ;;
dragonfly*) Khost_os=freebsd2 ;;
hpux*) Khost_os=hpux ;;
gnu*) Khost_os=gnu ;;
===================================================================
Checking out kaffe/config/i386/freebsd2/md.h
RCS: /home/cvs/kaffe/kaffe/config/i386/freebsd2/md.h,v
VERS: 1.17
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/config/i386/freebsd2/md.h Thu Nov 16 23:26:53 2006
@@ -0,0 +1,83 @@
+/*
+ * i386/freebsd2/md.h
+ * FreeBSD i386 configuration information.
+ *
+ * Copyright (c) 1996, 1997
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * Copyright (c) 2003, 2004
+ * Kaffe.org contributors. See ChangeLog for details.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+#ifndef __i386_freebsd2_md_h
+#define __i386_freebsd2_md_h
+
+#include "i386/common.h"
+#include "i386/threads.h"
+
+/* On FreeBSD <sys/time.h> needs to be included before
+ * <sys/resource.h>.
+ */
+#if defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#endif
+#if defined(HAVE_SYS_RESOURCE_H)
+#include <sys/resource.h>
+#endif
+#if defined(HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+
+
+#if defined(__GLIBC__)
+/* GNU/kFreeBSD requires a little initialisation */
+#include "i386/fpu-set.h"
+#define INIT_MD set_fpu_precision
+
+#else
+/*
+ * Redefine stack pointer offset.
+ */
+#undef SP_OFFSET
+#define SP_OFFSET 2
+
+/*
+ * Redefine the base pointer offset in a jmpbuf.
+ */
+#undef BP_OFFSET
+#define BP_OFFSET 3
+#endif
+
+/*
+ * FreeBSD does not save the floating point registers in the signal
+ * context, so we must do it ourselves.
+ */
+/* Size of buffer in bytes */
+#define SAVED_FP_SIZE 108
+#define SAVE_FP(fdata) \
+ asm("fsave %0": :"m"(*fdata))
+#define LOAD_FP(fdata) \
+ asm("frstor %0": :"m"(*fdata))
+
+/* Define signal context macros for xprofiling */
+#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(sc) (sc)
+#define SIGNAL_PC(scp) (scp)->sc_pc
+#define STACK_POINTER(scp) (scp)->sc_sp
+
+#if defined(TRANSLATOR)
+#include "jit-md.h"
+#endif
+
+#include "kaffe-unix-stack.h"
+
+#if defined(HAVE_SYS_SYSCTL_H)
+#define KAFFEMD_STACKEND
+extern void *mdGetStackEnd(void);
+#endif
+
+#endif
===================================================================
Checking out kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h
RCS: /home/cvs/kaffe/kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h,v
VERS: 1.13
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/config-jthreads.h Thu Nov 16 23:26:53 2006
@@ -0,0 +1,153 @@
+/*
+ * config.h
+ *
+ * Thread support using internal system.
+ *
+ * Copyright (c) 1996, 1997, 1998
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ *
+ * Written by Godmar Back <gback at cs.utah.edu> and
+ * Tim Wilkinson <tim at transvirtual.com>
+ */
+
+/*
+ * Note: this file get included only when jthreads are used outside
+ * the context of the virtual machine.
+ *
+ * The virtual machines uses definitions from the config directory
+ * for the specific processor.
+ */
+
+#ifndef __config_jthreads_h
+#define __config_jthreads_h
+
+#include "config.h"
+
+#include <assert.h>
+#include <setjmp.h>
+#include <sys/types.h>
+#include <sys/signal.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <signal.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define HAVE_SETITIMER 1
+#define HAVE_WAITPID 1
+#define THREADSTACKSIZE (32 * 1024)
+
+#if defined(__FreeBSD__)
+/*
+ * Stack offset.
+ * This is the offset into the setjmp buffer where the stack pointer is
+ * stored. In FreeBSD, that's 2 - normally it's 4 for a i386
+ * On NetBSD and OpenBSD it's 2 as well.
+ */
+#define SP_OFFSET 2
+#define HAVE_SYS_FILIO_H 1
+
+#elif defined(__linux__) && defined(mc68000)
+
+#define SP_OFFSET 14
+
+#elif (defined(__linux__) || (defined(__FreeBSD_kernel__) && defined (__GLIBC__))) && defined(i386)
+
+#define SP_OFFSET 4
+
+#elif defined(__svr4__) && defined(__sparc__)
+
+/* Solaris */
+#define SP_OFFSET 1
+#define HAVE_SYS_FILIO_H 1
+
+#elif defined(_AIX) && defined(_POWER)
+
+/* AIX on IBM PowerPC */
+#define SP_OFFSET 3
+#include <sys/select.h> /* another AIX oddity */
+
+#elif defined(hpux)
+
+/* HPUX */
+#define STACK_GROWS_UP 1
+#define SP_OFFSET 1
+
+#elif defined(hppa) && !defined(hpux)
+
+/* HP-BSD - this is a Utah thing */
+#define STACK_GROWS_UP 1
+#define SP_OFFSET 2
+
+/* We will clear all signals rather than just the ones we want.
+ * This is okay because of how sigprocmask is used - but it's not a
+ * general solition.
+ */
+#define sigprocmask(op, nsig, osig) sigsetmask(0)
+typedef int sigset_t;
+
+#elif defined(sgi) && defined(mips)
+
+/* SGI running IRIX 6.2 */
+#define SP_OFFSET 2
+#define FP_OFFSET 13
+
+#define SIGALTSTACK_NEEDS_END 1
+
+#elif defined(arm32) && defined(__NetBSD__)
+
+#define SP_OFFSET 23
+
+#elif defined(arm) && defined(linux)
+
+#define SP_OFFSET 20
+#define FP_OFFSET 19
+
+#else
+#error Your system was not yet tested
+#endif
+
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#ifndef FD_COPY
+#define FD_COPY(from, to) memcpy(to, from, sizeof(*(from)))
+#endif
+
+/* define our own jlong and NOTIMEOUT */
+typedef signed long long jlong;
+#define NOTIMEOUT -1
+#define true 1
+#define false 0
+
+#define catchSignal(s, h) signal(s, h) /* XXX use sigaction()? */
+
+static jlong currentTime()
+{
+ struct timeval tm;
+ gettimeofday(&tm, 0);
+ return (((jlong)tm.tv_sec * 1000L) + ((jlong)tm.tv_usec / 1000L));
+}
+
+/* debug.h stuff */
+#ifdef KAFFE_VMDEBUG
+#define DBG(x, y) y
+#define DBGEXPR(x, t, f) t
+#define DBGIF(x) x
+#else
+#define DBG(x, y)
+#define DBGEXPR(x, t, f) f
+#define DBGIF(x)
+#endif
+
+#endif /* __config_jthreads_h */
Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c
diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.93 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.94
--- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.93 Wed Aug 9 21:27:22 2006
+++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c Thu Nov 16 23:26:04 2006
@@ -97,7 +97,7 @@
* stringent priorities), but it usually isn't available on desktop
* OSes (or imposes certain restrictions, e.g. root privileges).
*/
-#if defined(HAVE_SCHED_OTHER_IN_SCHED)
+#if defined(HAVE_SCHED_OTHER_IN_SCHED) && !(defined(__FreeBSD_kernel__) && defined(__GLIBC__))
#define SCHEDULE_POLICY SCHED_OTHER
#else
#undef SCHEDULE_POLICY
More information about the kaffe
mailing list