From 9c12bd6d6b6d843e620d0b0c27cf91bf6fe84d15 Mon Sep 17 00:00:00 2001 From: _why Date: Tue, 28 Jul 2009 13:27:49 -0700 Subject: [PATCH] * core: allow safe compilation on non-x86, although continuations and jit will not function for now. --- core/callcc.c | 4 ++-- core/internal.h | 6 ++++-- core/vm-x86.c | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/callcc.c b/core/callcc.c index 31c62e0e..5d804ce0 100644 --- a/core/callcc.c +++ b/core/callcc.c @@ -32,7 +32,7 @@ PN potion_continuation_yield(Potion *P, PN cl, PN self) { // // move stack pointer, fill in stack, resume // -#ifdef POTION_X86 +#if POTION_X86 == POTION_JIT_TARGET #if __WORDSIZE == 64 __asm__ ("mov 0x8(%3), %%rsp;" "mov 0x10(%3), %%rbp;" @@ -105,7 +105,7 @@ PN potion_callcc(Potion *P, PN cl, PN self) { cc->stack[0] = (PN)sp1; cc->stack[1] = (PN)sp2; cc->stack[2] = (PN)sp3; -#ifdef POTION_X86 +#if POTION_X86 == POTION_JIT_TARGET #if __WORDSIZE == 64 __asm__ ("mov %%rbx, 0x18(%0);" "mov %%r12, 0x20(%0);" diff --git a/core/internal.h b/core/internal.h index 9b30c948..d721f070 100644 --- a/core/internal.h +++ b/core/internal.h @@ -84,7 +84,7 @@ int potion_munmap(void *, size_t); // // stack manipulation routines // -#ifdef POTION_X86 +#if POTION_X86 == POTION_JIT_TARGET #if __WORDSIZE == 64 #define PN_SAVED_REGS 5 #define POTION_ESP(p) __asm__("mov %%rsp, %0" : "=r" (*p)) @@ -95,8 +95,10 @@ int potion_munmap(void *, size_t); #define POTION_EBP(p) __asm__("mov %%ebp, %0" : "=r" (*p)) #endif #else +#define PN_SAVED_REGS 0 __attribute__ ((noinline)) void potion_esp(void **); -#define POTION_ESP(p) potion_esp(p) +#define POTION_ESP(p) potion_esp((void **)p) +#define POTION_EBP(p) potion_esp((void **)p) #endif #ifndef O_BINARY diff --git a/core/vm-x86.c b/core/vm-x86.c index fdb717c1..7e1a0a53 100644 --- a/core/vm-x86.c +++ b/core/vm-x86.c @@ -94,6 +94,7 @@ void potion_x86_debug() { int n = 0; _PN rax, *rbp, *sp; +#if POTION_X86 == POTION_JIT_TARGET #if __WORDSIZE != 64 __asm__ ("mov %%eax, %0;" #else @@ -110,6 +111,7 @@ void potion_x86_debug() { #endif :"=r"(sp) ); +#endif P = (Potion *)sp[2]; printf("Potion: %p (%p)\n", P, &P);