pkgsrc/lang/kaffe/patches/patch-bb
dholland fd98482e86 Add bits for supporting NetBSD on x86_64.
This builds, and will compile and run helloworld, but hasn't been
particularly extensively tested.

No version bump since no prior x86_64 packages should have been created.
2009-10-19 06:03:16 +00:00

69 lines
1.8 KiB
Text

$NetBSD: patch-bb,v 1.1 2009/10/19 06:03:16 dholland Exp $
--- /dev/null 2009-10-19 01:12:00.000000000 -0400
+++ config/x86_64/netbsd1/md.h 2009-10-19 01:22:18.000000000 -0400
@@ -0,0 +1,64 @@
+/*
+ * x86_64/netbsd1/md.h
+ * NetBSD AMD64 configuration information.
+ *
+ * Copyright (c) 2003, 2004, 2005
+ * Kaffe.org contributors. See ChangeLog for details.
+ *
+ * Copyright (c) 2002
+ * MandrakeSoft. All rights reserved.
+ *
+ * Copyright (c) 2001
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+#ifndef __amd64_netbsd_md_h
+#define __amd64_netbsd_md_h
+
+#include "x86_64/common.h"
+#include "x86_64/threads.h"
+
+#undef SP_OFFSET
+#define SP_OFFSET 2
+#undef FP_OFFSET
+#define FP_OFFSET 3
+
+#if defined(HAVE_SYS_UCONTEXT_H)
+#include <sys/ucontext.h>
+
+/* older netbsd's could have this macro missing, so we provide it */
+#ifndef _UC_MACHINE_SP
+#define _UC_MACHINE_SP(uc) ((uc)->uc_mcontext.__gregs[_REG_URSP])
+#endif
+#ifndef _UC_MACHINE_PC
+#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_RIP])
+#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 SIGNAL_PC(scp) _UC_MACHINE_PC(((SIGCONTEXT *)(scp)))
+#define STACK_POINTER(scp) _UC_MACHINE_SP(((SIGCONTEXT *)(scp)))
+#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc)
+
+#else
+
+#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_rsp
+
+#endif
+
+#if defined(TRANSLATOR)
+#include "jit-md.h"
+#endif
+
+#include "kaffe-unix-stack.h"
+
+#endif