Initial support for NetBSD/ppc in native mode (some crashes occur but I

could boot MacOS 9.0.4)
This commit is contained in:
gbeauche 2005-02-20 18:08:50 +00:00
parent 436522186e
commit 8500381648
4 changed files with 24 additions and 4 deletions

View File

@ -204,6 +204,26 @@ struct machine_regs : public pt_regs
}; };
#endif #endif
#if defined(__NetBSD__)
#include <sys/ucontext.h>
#define MACHINE_REGISTERS(scp) ((machine_regs *)&(((ucontext_t *)scp)->uc_mcontext))
struct machine_regs : public mcontext_t
{
long & cr() { return __gregs[_REG_CR]; }
uint32 cr() const { return __gregs[_REG_CR]; }
uint32 lr() const { return __gregs[_REG_LR]; }
uint32 ctr() const { return __gregs[_REG_CTR]; }
uint32 xer() const { return __gregs[_REG_XER]; }
uint32 msr() const { return __gregs[_REG_MSR]; }
uint32 dar() const { return (uint32)(((siginfo_t *)(((unsigned long)this) - offsetof(ucontext_t, uc_mcontext))) - 1)->si_addr; } /* HACK */
long & pc() { return __gregs[_REG_PC]; }
uint32 pc() const { return __gregs[_REG_PC]; }
long & gpr(int i) { return __gregs[_REG_R0 + i]; }
uint32 gpr(int i) const { return __gregs[_REG_R0 + i]; }
};
#endif
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
#include <sys/signal.h> #include <sys/signal.h>
extern "C" int sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss); extern "C" int sigaltstack(const struct sigaltstack *ss, struct sigaltstack *oss);

View File

@ -18,7 +18,7 @@
#endif #endif
/* Register names */ /* Register names */
#if defined(__linux__) #if defined(__linux__) || defined(__NetBSD__)
#define r0 0 #define r0 0
#define r1 1 #define r1 1
#define r2 2 #define r2 2
@ -53,7 +53,7 @@
#define r31 31 #define r31 31
#endif #endif
#if defined(__linux__) #if defined(__linux__) || defined(__NetBSD__)
#define f0 0 #define f0 0
#define f1 1 #define f1 1
#define f2 2 #define f2 2

View File

@ -413,7 +413,7 @@ typedef struct timeval tm_time_t;
extern uint64 GetTicks_usec(void); extern uint64 GetTicks_usec(void);
extern void Delay_usec(uint32 usec); extern void Delay_usec(uint32 usec);
#if defined(HAVE_PTHREADS) || (defined(__linux__) && defined(__powerpc__)) #if defined(HAVE_PTHREADS) || ((defined(__linux__) || defined(__NetBSD__)) && defined(__powerpc__))
// Setup pthread attributes // Setup pthread attributes
extern void Set_pthread_attr(pthread_attr_t *attr, int priority); extern void Set_pthread_attr(pthread_attr_t *attr, int priority);
#endif #endif

View File

@ -215,7 +215,7 @@ bool ThunksInit(void)
native_op[NATIVE_R_GET_RESOURCE].func = r_get_resource_func; native_op[NATIVE_R_GET_RESOURCE].func = r_get_resource_func;
#endif #endif
#else #else
#if defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) #if defined(__linux__) || defined(__NetBSD__) || (defined(__APPLE__) && defined(__MACH__))
#define DEFINE_NATIVE_OP(ID, FUNC) do { \ #define DEFINE_NATIVE_OP(ID, FUNC) do { \
uintptr base = SheepMem::Reserve(8); \ uintptr base = SheepMem::Reserve(8); \
WriteMacInt32(base + 0, (uint32)FUNC); \ WriteMacInt32(base + 0, (uint32)FUNC); \