$NetBSD: patch-ag,v 1.7 2009/07/10 19:58:12 abs Exp $ (unfortunately) incomplete patch to update NetBSD/m68k to be closer to working --- config/m68k/netbsd1/md.h.orig 2009-02-05 20:12:32.000000000 +0000 +++ config/m68k/netbsd1/md.h @@ -17,34 +17,65 @@ #include "m68k/common.h" #include "m68k/threads.h" +#if defined(HAVE_SIGNAL_H) +#include +#endif +#if defined(HAVE_SYS_RESOURCE_H) +#include +#endif +#if defined(HAVE_SYS_SIGNAL_H) +#include +#endif +#if defined(HAVE_UNISTD_H) +#include +#endif + /* * Alignment in structure is 8 bytes packed */ #define ALIGNMENT_OF_SIZE(S) ((S) < 8 ? (S) : 8) /* - * Stack offset. - * This is the offset into the setjmp buffer where the stack pointer is - * stored. + * Redefine stack pointer offset. */ -#define SP_OFFSET 2 +#undef SP_OFFSET +#define SP_OFFSET 2 -/**/ -/* Extra exception handling information. */ -/**/ -#include +#if defined(HAVE_SYS_UCONTEXT_H) +#include -#define SIGNAL_ARGS(sig, sc) int sig, int code, struct sigcontext *sc +/* 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_UESP]) +#endif +#ifndef _UC_MACHINE_PC +#define _UC_MACHINE_PC(uc) ((uc)->uc_mcontext.__gregs[_REG_EIP]) +#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(scp) (scp) -#define SIGNAL_PC(scp) ((uintp)(scp)->sc_pc) +#define GET_SIGNAL_CONTEXT_POINTER(sc) (sc) +#define SIGNAL_PC(scp) (scp)->sc_pc +#define STACK_POINTER(scp) (scp)->sc_sp -#include "kaffe-unix-stack.h" +#endif #if defined(TRANSLATOR) #include "jit-md.h" #endif +#include "kaffe-unix-stack.h" + /* * sysdepCallMethod supports: *