More build system work

release
Slava 2007-09-22 00:44:27 -04:00
parent 2892083014
commit 6dc28869ce
14 changed files with 56 additions and 93 deletions

View File

@ -44,21 +44,20 @@ EXE_OBJS = $(PLAF_EXE_OBJS)
default: default:
@echo "Run 'make' with one of the following parameters:" @echo "Run 'make' with one of the following parameters:"
@echo "" @echo ""
@echo "freebsd-x86" @echo "freebsd-x86-32"
@echo "freebsd-amd64" @echo "freebsd-x86-64"
@echo "linux-x86" @echo "linux-x86-32"
@echo "linux-amd64" @echo "linux-x86-64"
@echo "linux-ppc" @echo "linux-ppc"
@echo "linux-arm" @echo "linux-arm"
@echo "openbsd-x86" @echo "openbsd-x86-32"
@echo "openbsd-amd64" @echo "openbsd-x86-64"
@echo "macosx-x86" @echo "macosx-x86-32"
@echo "macosx-ppc" @echo "macosx-ppc"
@echo "solaris-x86" @echo "solaris-x86-32"
@echo "solaris-amd64" @echo "solaris-x86-64"
@echo "windows-ce-arm" @echo "windows-ce-arm"
@echo "windows-ce-x86" @echo "windows-nt-x86-32"
@echo "windows-nt-x86"
@echo "" @echo ""
@echo "Additional modifiers:" @echo "Additional modifiers:"
@echo "" @echo ""
@ -67,17 +66,17 @@ default:
@echo "NO_UI=1 don't link with X11 libraries (ignored on Mac OS X)" @echo "NO_UI=1 don't link with X11 libraries (ignored on Mac OS X)"
@echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)" @echo "X11=1 force link with X11 libraries instead of Cocoa (only on Mac OS X)"
openbsd-x86: openbsd-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86.32
openbsd-amd64: openbsd-x86-64:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.amd64 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.openbsd.x86.64
freebsd-x86: freebsd-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86.32
freebsd-amd64: freebsd-x86-64:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.amd64 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.freebsd.x86.64
macosx-freetype: macosx-freetype:
ln -sf libfreetype.6.dylib \ ln -sf libfreetype.6.dylib \
@ -86,14 +85,14 @@ macosx-freetype:
macosx-ppc: macosx-freetype macosx-ppc: macosx-freetype
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.ppc
macosx-x86: macosx-freetype macosx-x86-32: macosx-freetype
$(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86 $(MAKE) $(EXECUTABLE) macosx.app CONFIG=vm/Config.macosx.x86.32
linux-x86: linux-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.32
linux-amd64: linux-x86-64:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.amd64 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.x86.64
linux-ppc: linux-ppc:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.ppc $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.ppc
@ -101,21 +100,18 @@ linux-ppc:
linux-arm: linux-arm:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.arm $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.linux.arm
solaris-x86: solaris-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.32
solaris-amd64: solaris-x86-64:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.amd64 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.solaris.x86.64
windows-nt-x86: windows-nt-x86-32:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86 $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
windows-ce-arm: windows-ce-arm:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm $(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
windows-ce-x86:
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.x86
macosx.app: factor macosx.app: factor
mkdir -p $(BUNDLE)/Contents/MacOS mkdir -p $(BUNDLE)/Contents/MacOS
cp $(EXECUTABLE) $(BUNDLE)/Contents/MacOS/factor cp $(EXECUTABLE) $(BUNDLE)/Contents/MacOS/factor

View File

@ -1,2 +1 @@
BOOT_ARCH = arm
PLAF_DLL_OBJS += vm/cpu-arm.o PLAF_DLL_OBJS += vm/cpu-arm.o

View File

@ -1,2 +1 @@
BOOT_ARCH = ppc
PLAF_DLL_OBJS += vm/cpu-ppc.o PLAF_DLL_OBJS += vm/cpu-ppc.o

View File

@ -1,2 +1 @@
BOOT_ARCH = amd64
PLAF_DLL_OBJS += vm/cpu-x86.64.o PLAF_DLL_OBJS += vm/cpu-x86.64.o

View File

@ -1,8 +0,0 @@
#include "asm.h"
/* Callable from C as
void *native_stack_pointer(void) */
.globl MANGLE(native_stack_pointer)
MANGLE(native_stack_pointer):
mov %rsp,%rax
ret

View File

@ -1,20 +0,0 @@
#define FACTOR_CPU_STRING "x86.64"
register CELL ds asm("r14");
register CELL rs asm("r15");
void **primitives;
INLINE void flush_icache(CELL start, CELL len) {}
void *native_stack_pointer(void);
typedef CELL F_COMPILED_FRAME;
#define PREVIOUS_FRAME(frame) (frame + 1)
#define RETURN_ADDRESS(frame) (*(frame))
INLINE void execute(CELL word)
{
F_WORD *untagged = untag_object(word);
untagged->xt(word);
}

View File

@ -8,16 +8,16 @@ and the callstack top is passed in EDX */
#define ARG1 %edx #define ARG1 %edx
#define XT_REG %ecx #define XT_REG %ecx
#define STACK_REG %esp #define STACK_REG %esp
#define DS_REG %edi #define DS_REG %esi
#define CELL_SIZE 4 #define CELL_SIZE 4
#define PUSH_NONVOLATILE \ #define PUSH_NONVOLATILE \
push %ebx \ push %ebx ; \
push %ebp push %ebp
#define POP_NONVOLATILE \ #define POP_NONVOLATILE \
pop %ebp \ pop %ebp ; \
pop %ebx pop %ebx
#define QUOT_XT_OFFSET 5 #define QUOT_XT_OFFSET 5

View File

@ -4,5 +4,3 @@ register CELL ds asm("esi");
register CELL rs asm("edi"); register CELL rs asm("edi");
#define FASTCALL __attribute__ ((regparm (2))) #define FASTCALL __attribute__ ((regparm (2)))
void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);

View File

@ -9,19 +9,19 @@
#define CELL_SIZE 8 #define CELL_SIZE 8
#define PUSH_NONVOLATILE \ #define PUSH_NONVOLATILE \
push %rbx \ push %rbx ; \
push %rbp \ push %rbp ; \
push %r12 \ push %r12 ; \
push %r13 \ push %r13 ; \
push %r16 \ push %r16 ; \
push %rax /* Alignment */ push %rax /* Alignment */
#define POP_NONVOLATILE \ #define POP_NONVOLATILE \
pop %rax /* Alignment */ \ pop %rax ; /* Alignment */ \
pop %r16 \ pop %r16 ; \
pop %r13 \ pop %r13 ; \
pop %r12 \ pop %r12 ; \
pop %rbp \ pop %rbp ; \
pop %rbx pop %rbx
#define QUOT_XT_OFFSET 13 #define QUOT_XT_OFFSET 13

View File

@ -10,7 +10,7 @@ DEF(FASTCALL void,c_to_factor,(CELL quot)):
call MANGLE(save_callstack_bottom) call MANGLE(save_callstack_bottom)
mov (STACK_REG),ARG0 /* Pass quot as arg 1 */ mov (STACK_REG),ARG0 /* Pass quot as arg 1 */
mov QUOT_XT_OFFSET(STACK_REG),XT_REG mov QUOT_XT_OFFSET(ARG0),XT_REG
call *XT_REG /* Call quot-xt */ call *XT_REG /* Call quot-xt */
POP ARG0 POP ARG0
@ -18,7 +18,7 @@ DEF(FASTCALL void,c_to_factor,(CELL quot)):
ret ret
DEF(FASTCALL void,undefined,(CELL word)): DEF(FASTCALL void,undefined,(CELL word)):
mov STACK_REG,ARG1 /* Pass callstack pointer as arg 2 (not fastcall) */ mov STACK_REG,ARG1 /* Pass callstack pointer */
jmp MANGLE(undefined_error) /* This throws an error */ jmp MANGLE(undefined_error) /* This throws an error */
DEF(FASTCALL void,dosym,(CELL word)): DEF(FASTCALL void,dosym,(CELL word)):
@ -31,7 +31,7 @@ enabled */
DEF(FASTCALL void,docol_profiling,(CELL word)): DEF(FASTCALL void,docol_profiling,(CELL word)):
add $CELL_SIZE,PROFILING_OFFSET(%eax) /* Increment profile-count slot */ add $CELL_SIZE,PROFILING_OFFSET(%eax) /* Increment profile-count slot */
DEF(FASTCALL void,docol,(CELL word)): DEF(FASTCALL void,docol,(CELL word)):
mov WORD_XT_OFFSET(ARG0),ARG0 /* Load word-def slot */ mov WORD_DEF_OFFSET(ARG0),ARG0 /* Load word-def slot */
JUMP_QUOT JUMP_QUOT
/* We must pass the XT to the quotation in ECX. */ /* We must pass the XT to the quotation in ECX. */

View File

@ -28,3 +28,5 @@ FASTCALL void undefined(CELL word);
FASTCALL void dosym(CELL word); FASTCALL void dosym(CELL word);
FASTCALL void docol_profiling(CELL word); FASTCALL void docol_profiling(CELL word);
FASTCALL void docol(CELL word); FASTCALL void docol(CELL word);
void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);

View File

@ -13,10 +13,8 @@
#if defined(WINDOWS) #if defined(WINDOWS)
#if defined(WINCE) #if defined(WINCE)
#include "os-windows-ce.h" #include "os-windows-ce.h"
#elif defined (__i386)
#include "os-windows-nt.h"
#else #else
#error "Unsupported Windows flavor" #include "os-windows-nt.h"
#endif #endif
#include "os-windows.h" #include "os-windows.h"
@ -44,7 +42,7 @@
#include "os-unix-ucontext.h" #include "os-unix-ucontext.h"
#if defined(FACTOR_X86) #if defined(FACTOR_X86)
#include "os-freebsd-x86.h" #include "os-freebsd-x86.32.h"
#else #else
#error "Unsupported FreeBSD flavor" #error "Unsupported FreeBSD flavor"
#endif #endif
@ -53,9 +51,9 @@
#include "os-openbsd.h" #include "os-openbsd.h"
#if defined(FACTOR_X86) #if defined(FACTOR_X86)
#include "os-openbsd-x86.h" #include "os-openbsd-x86.32.h"
#elif defined(FACTOR_AMD64) #elif defined(FACTOR_AMD64)
#include "os-openbsd-amd64.h" #include "os-openbsd-x86.64.h"
#else #else
#error "Unsupported OpenBSD flavor" #error "Unsupported OpenBSD flavor"
#endif #endif
@ -86,11 +84,11 @@
#endif #endif
#if defined(FACTOR_X86) #if defined(FACTOR_X86)
#include "cpu-x86.h"
#include "cpu-x86.32.h" #include "cpu-x86.32.h"
#elif defined(FACTOR_AMD64)
#include "cpu-x86.h" #include "cpu-x86.h"
#elif defined(FACTOR_AMD64)
#include "cpu-x86.64.h" #include "cpu-x86.64.h"
#include "cpu-x86.h"
#elif defined(FACTOR_PPC) #elif defined(FACTOR_PPC)
#include "cpu-ppc.h" #include "cpu-ppc.h"
#elif defined(FACTOR_ARM) #elif defined(FACTOR_ARM)

View File

@ -199,7 +199,7 @@ void not_implemented_error(void)
} }
/* This function is called from the undefined function in cpu_*.S */ /* This function is called from the undefined function in cpu_*.S */
void undefined_error(CELL word, F_STACK_FRAME *callstack_top) FASTCALL void undefined_error(CELL word, F_STACK_FRAME *callstack_top)
{ {
stack_chain->callstack_top = callstack_top; stack_chain->callstack_top = callstack_top;
general_error(ERROR_UNDEFINED_WORD,word,F,NULL); general_error(ERROR_UNDEFINED_WORD,word,F,NULL);

View File

@ -19,7 +19,7 @@ void fix_stacks(void)
} }
/* called before entry into Factor code. */ /* called before entry into Factor code. */
void save_callstack_bottom(F_STACK_FRAME *callstack_bottom) FASTCALL void save_callstack_bottom(F_STACK_FRAME *callstack_bottom)
{ {
stack_chain->callstack_bottom = callstack_bottom; stack_chain->callstack_bottom = callstack_bottom;
} }