From 109da009d2e5c6910b27609e069b9b32619e7cec Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Tue, 30 Aug 2005 11:37:41 +0000 Subject: [PATCH] fix build on ppc. no guarantee it runs though --- code/qcommon/vm.c | 21 ++++++++++++++------- code/unix/Makefile | 25 +++++++++++++++++-------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c index b509700e..a7f86ab7 100644 --- a/code/qcommon/vm.c +++ b/code/qcommon/vm.c @@ -450,11 +450,6 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *), Com_Error( ERR_FATAL, "VM_Create: bad parms" ); } -#if !defined(__i386__) && !defined(__ppc__) - if(interpret >= VMI_COMPILED) - interpret = VMI_BYTECODE; -#endif - remaining = Hunk_MemoryRemaining(); // see if we already have the VM @@ -481,6 +476,7 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *), Q_strncpyz( vm->name, module, sizeof( vm->name ) ); vm->systemCall = systemCalls; +#if defined(HAVE_VM_NATIVE) // never allow dll loading with a demo if ( interpret == VMI_NATIVE ) { if ( Cvar_VariableValue( "fs_restrict" ) ) { @@ -499,6 +495,12 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *), Com_Printf( "Failed to load dll, looking for qvm.\n" ); interpret = VMI_COMPILED; } +#else + if ( interpret == VMI_NATIVE ) { + Com_Printf("Architecture doesn't support native dll's, using qvm\n"); + interpret = VMI_COMPILED; + } +#endif // load the image Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name ); @@ -551,6 +553,13 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *), // copy or compile the instructions vm->codeLength = header->codeLength; +#if !defined(HAVE_VM_COMPILED) + if(interpret >= VMI_COMPILED) { + Com_Printf("Architecture doesn't have a bytecode compiler, using interpreter\n"); + interpret = VMI_BYTECODE; + } +#endif + if ( interpret >= VMI_COMPILED ) { vm->compiled = qtrue; VM_Compile( vm, header ); @@ -707,10 +716,8 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) { args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11], args[12], args[13], args[14], args[15]); -#if defined(__ppc__) || defined(__i386__) } else if ( vm->compiled ) { r = VM_CallCompiled( vm, &callnum ); -#endif } else { struct { int callnum; diff --git a/code/unix/Makefile b/code/unix/Makefile index 6d2d2fa2..10e8dc57 100644 --- a/code/unix/Makefile +++ b/code/unix/Makefile @@ -103,6 +103,10 @@ ifeq ($(PLATFORM),linux) else ifeq ($(ARCH),x86_64) LIB=lib64 + else + ifeq ($(ARCH),ppc) + VM_PPC=vm_none + endif endif endif @@ -125,10 +129,15 @@ ifeq ($(PLATFORM),linux) DEBUG_CFLAGS += -O0 OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer -fno-strict-aliasing ifeq ($(ARCH),x86_64) - OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fstrength-reduce -fno-strict-aliasing + OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fstrength-reduce -fno-strict-aliasing else ifeq ($(ARCH),i386) - OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce + OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce + BASE_CFLAGS += -DHAVE_VM_NATIVE -DHAVE_VM_COMPILED + else + ifeq ($(ARCH),ppc) + BASE_CFLAGS += -DHAVE_VM_NATIVE + endif endif endif @@ -511,7 +520,7 @@ Q3OBJ = \ ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) - Q3OBJ += $(B)/client/vm_ppc.o + Q3OBJ += $(B)/client/$(VM_PPC).o endif endif @@ -742,7 +751,7 @@ endif ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) -$(B)/client/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC) +$(B)/client/$(VM_PPC).o : $(CMDIR)/$(VM_PPC).c; $(DO_CC) endif endif @@ -835,7 +844,7 @@ endif ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) - Q3DOBJ += $(B)/ded/vm_ppc.o + Q3DOBJ += $(B)/ded/$(VM_PPC).o endif endif @@ -920,7 +929,7 @@ endif ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) -$(B)/ded/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_DED_CC) +$(B)/ded/$(VM_PPC).o : $(CMDIR)/$(VM_PPC).c; $(DO_DED_CC) endif endif @@ -1547,7 +1556,7 @@ endif ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) - Q3SOBJ += $(B)/q3static/vm_ppc.o + Q3SOBJ += $(B)/q3static/$(VM_PPC).o endif endif @@ -1706,7 +1715,7 @@ endif ifeq ($(ARCH),ppc) ifeq ($(DLL_ONLY),false) -$(B)/q3static/vm_ppc.o : $(CMDIR)/vm_ppc.c; $(DO_CC) -DQ3_STATIC +$(B)/q3static/$(VM_PPC).o : $(CMDIR)/$(VM_PPC).c; $(DO_CC) -DQ3_STATIC endif endif