[kaffe] CVS kaffe (robilad): fixes for openbsd stack handling
Kaffe CVS
cvs-commits at kaffe.org
Thu Mar 23 11:08:47 PST 2006
PatchSet 7161
Date: 2006/03/23 18:29:18
Author: robilad
Branch: HEAD
Tag: (none)
Log:
fixes for openbsd stack handling
2006-03-23 Kurt Miller <truk at optonline.net>
Fixes for OpenBSD stack handling.
* config/i386/openbsd2/md.c (mdGetStackEnd, mdGetStackSize):
Added.
* config/i386/openbsd2/md.h (KAFFEMD_STACK_ERROR, KAFFEMD_STACK_INFINITE,
KAFFEMD_STACKSIZE, mdSetStackSize, KAFFEMD_STACKEND) Added.
Members:
ChangeLog:1.4679->1.4680
config/i386/openbsd2/md.c:1.1->1.2
config/i386/openbsd2/md.h:INITIAL->1.12
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4679 kaffe/ChangeLog:1.4680
--- kaffe/ChangeLog:1.4679 Thu Mar 23 01:33:17 2006
+++ kaffe/ChangeLog Thu Mar 23 18:29:18 2006
@@ -1,3 +1,13 @@
+2006-03-23 Kurt Miller <truk at optonline.net>
+
+ Fixes for OpenBSD stack handling.
+
+ * config/i386/openbsd2/md.c (mdGetStackEnd, mdGetStackSize):
+ Added.
+
+ * config/i386/openbsd2/md.h (KAFFEMD_STACK_ERROR, KAFFEMD_STACK_INFINITE,
+ KAFFEMD_STACKSIZE, mdSetStackSize, KAFFEMD_STACKEND) Added.
+
2006-03-22 Dalibor Topic <robilad at kaffe.org>
Fix for #30.
Index: kaffe/config/i386/openbsd2/md.c
diff -u kaffe/config/i386/openbsd2/md.c:1.1 kaffe/config/i386/openbsd2/md.c:1.2
--- kaffe/config/i386/openbsd2/md.c:1.1 Tue Mar 31 19:10:53 1998
+++ kaffe/config/i386/openbsd2/md.c Thu Mar 23 18:29:24 2006
@@ -8,3 +8,34 @@
* See the file "license.terms" for information on usage and redistribution
* of this file.
*/
+
+#include <sys/signal.h>
+#include <pthread.h>
+#include <pthread_np.h>
+#include <stdio.h>
+
+void *mdGetStackEnd(void)
+{
+ stack_t stack;
+ if (pthread_stackseg_np(pthread_self(), &stack) != 0)
+ {
+ fprintf(stderr,
+ "Kaffe VM has not been able to retrieve the pointer to the stack base\n"
+ "Aborting...\n");
+ exit(1);
+ }
+ return stack.ss_sp;
+}
+
+size_t mdGetStackSize(void)
+{
+ stack_t stack;
+ if (pthread_stackseg_np(pthread_self(), &stack) != 0)
+ {
+ fprintf(stderr,
+ "Kaffe VM has not been able to retrieve the stack size\n"
+ "Aborting...\n");
+ exit(1);
+ }
+ return stack.ss_size;
+}
===================================================================
Checking out kaffe/config/i386/openbsd2/md.h
RCS: /home/cvs/kaffe/kaffe/config/i386/openbsd2/md.h,v
VERS: 1.12
***************
--- /dev/null Sun Aug 4 19:57:58 2002
+++ kaffe/config/i386/openbsd2/md.h Thu Mar 23 19:08:46 2006
@@ -0,0 +1,68 @@
+/*
+ * i386/openbsd2/md.h
+ * OpenBSD 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_openbsd2_md_h
+#define __i386_openbsd2_md_h
+
+#include "i386/common.h"
+#include "i386/threads.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
+
+/*
+ * Redefine stack pointer offset.
+ */
+#undef SP_OFFSET
+#define SP_OFFSET 2
+
+/* 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
+
+#define KAFFEMD_STACK_ERROR 0
+#define KAFFEMD_STACK_INFINITE KAFFEMD_STACK_ERROR
+
+#define KAFFEMD_STACKSIZE
+extern size_t mdGetStackSize(void);
+
+/* this is only used for the main thread and is ok for that */
+/* this may change with rthreads when thats done */
+static inline void mdSetStackSize(rlim_t limit)
+{
+ struct rlimit rl;
+
+ getrlimit(RLIMIT_STACK, &rl);
+ rl.rlim_cur = limit;
+ setrlimit(RLIMIT_STACK, &rl);
+}
+
+#define KAFFEMD_STACKEND
+extern void *mdGetStackEnd(void);
+
+#endif
More information about the kaffe
mailing list