mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2024-11-10 14:41:42 +00:00
add x86_64 vm. experimental, not enabled by default. you need as for it
to work.
This commit is contained in:
parent
9af615f27c
commit
0bf8e3a8b0
8 changed files with 1304 additions and 10 deletions
|
@ -38,6 +38,8 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "bg_lib.h"
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
|
static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
|
||||||
|
|
|
@ -23,6 +23,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
// compiled for the virtual machine
|
// compiled for the virtual machine
|
||||||
|
|
||||||
// This file is NOT included on native builds
|
// This file is NOT included on native builds
|
||||||
|
#ifndef BG_LIB_H
|
||||||
|
#define BG_LIB_H
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL ((void *)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int size_t;
|
typedef int size_t;
|
||||||
|
|
||||||
|
@ -89,3 +95,4 @@ int abs( int n );
|
||||||
double fabs( double x );
|
double fabs( double x );
|
||||||
double acos( double x );
|
double acos( double x );
|
||||||
|
|
||||||
|
#endif // BG_LIB_H
|
||||||
|
|
|
@ -286,7 +286,7 @@ Cvar_Set2
|
||||||
cvar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force ) {
|
cvar_t *Cvar_Set2( const char *var_name, const char *value, qboolean force ) {
|
||||||
cvar_t *var;
|
cvar_t *var;
|
||||||
|
|
||||||
Com_DPrintf( "Cvar_Set2: %s %s\n", var_name, value );
|
// Com_DPrintf( "Cvar_Set2: %s %s\n", var_name, value );
|
||||||
|
|
||||||
if ( !Cvar_ValidateString( var_name ) ) {
|
if ( !Cvar_ValidateString( var_name ) ) {
|
||||||
Com_Printf("invalid cvar name string: %s\n", var_name );
|
Com_Printf("invalid cvar name string: %s\n", var_name );
|
||||||
|
|
|
@ -547,6 +547,8 @@ void FS_FreeFileList( char **list );
|
||||||
|
|
||||||
qboolean FS_FileExists( const char *file );
|
qboolean FS_FileExists( const char *file );
|
||||||
|
|
||||||
|
char *FS_BuildOSPath( const char *base, const char *game, const char *qpath );
|
||||||
|
|
||||||
int FS_LoadStack( void );
|
int FS_LoadStack( void );
|
||||||
|
|
||||||
int FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
|
int FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
|
||||||
|
@ -603,7 +605,7 @@ int FS_FTell( fileHandle_t f );
|
||||||
|
|
||||||
void FS_Flush( fileHandle_t f );
|
void FS_Flush( fileHandle_t f );
|
||||||
|
|
||||||
void QDECL FS_Printf( fileHandle_t f, const char *fmt, ... );
|
void QDECL FS_Printf( fileHandle_t f, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
|
||||||
// like fprintf
|
// like fprintf
|
||||||
|
|
||||||
int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode );
|
int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode );
|
||||||
|
|
|
@ -745,12 +745,15 @@ long QDECL VM_Call( vm_t *vm, long callnum, ... ) {
|
||||||
args[4], args[5], args[6], args[7],
|
args[4], args[5], args[6], args[7],
|
||||||
args[8], args[9], args[10], args[11],
|
args[8], args[9], args[10], args[11],
|
||||||
args[12], args[13], args[14], args[15]);
|
args[12], args[13], args[14], args[15]);
|
||||||
#if defined(HAVE_VM_COMPILED)
|
|
||||||
} else if ( vm->compiled ) {
|
|
||||||
// only used on 32bit machines so this cast is fine
|
|
||||||
r = VM_CallCompiled( vm, (int*)&callnum );
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef __i386__ // i386 calling convention doesn't need conversion
|
||||||
|
#if defined(HAVE_VM_COMPILED)
|
||||||
|
if ( vm->compiled )
|
||||||
|
r = VM_CallCompiled( vm, (int*)callnum );
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
r = VM_CallInterpreted( vm, (int*)callnum );
|
||||||
|
#else
|
||||||
struct {
|
struct {
|
||||||
int callnum;
|
int callnum;
|
||||||
int args[16];
|
int args[16];
|
||||||
|
@ -763,7 +766,13 @@ long QDECL VM_Call( vm_t *vm, long callnum, ... ) {
|
||||||
a.args[i] = va_arg(ap, long);
|
a.args[i] = va_arg(ap, long);
|
||||||
}
|
}
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
r = VM_CallInterpreted( vm, &a.callnum );
|
#if defined(HAVE_VM_COMPILED)
|
||||||
|
if ( vm->compiled )
|
||||||
|
r = VM_CallCompiled( vm, &a.callnum );
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
r = VM_CallInterpreted( vm, &a.callnum );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL
|
if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL
|
||||||
|
|
1264
code/qcommon/vm_x86_64.c
Normal file
1264
code/qcommon/vm_x86_64.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -135,6 +135,8 @@ ifeq ($(PLATFORM),linux)
|
||||||
OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 \
|
OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 \
|
||||||
-falign-jumps=2 -falign-functions=2 -fstrength-reduce \
|
-falign-jumps=2 -falign-functions=2 -fstrength-reduce \
|
||||||
-fno-strict-aliasing
|
-fno-strict-aliasing
|
||||||
|
# experimental! you need as
|
||||||
|
# BASE_CFLAGS += -DHAVE_VM_COMPILED
|
||||||
else
|
else
|
||||||
ifeq ($(ARCH),i386)
|
ifeq ($(ARCH),i386)
|
||||||
OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math \
|
OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math \
|
||||||
|
@ -404,7 +406,7 @@ endif
|
||||||
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
|
DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
|
||||||
DO_CXX=$(CXX) $(CFLAGS) -o $@ -c $<
|
DO_CXX=$(CXX) $(CFLAGS) -o $@ -c $<
|
||||||
DO_SMP_CC=$(CC) $(CFLAGS) -DSMP -o $@ -c $<
|
DO_SMP_CC=$(CC) $(CFLAGS) -DSMP -o $@ -c $<
|
||||||
DO_BOT_CC=$(CC) $(CFLAGS) -DBOTLIB -o $@ -c $< # $(SHLIBCFLAGS) # bk001212
|
DO_BOT_CC=$(CC) $(CFLAGS) -DBOTLIB -o $@ -c $< # $(SHLIBCFLAGS) # bk001212
|
||||||
DO_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -o $@ -c $<
|
DO_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -o $@ -c $<
|
||||||
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
DO_SHLIB_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
DO_SHLIB_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
|
||||||
|
@ -618,6 +620,9 @@ endif
|
||||||
ifeq ($(ARCH),x86)
|
ifeq ($(ARCH),x86)
|
||||||
Q3OBJ += $(B)/client/vm_x86.o
|
Q3OBJ += $(B)/client/vm_x86.o
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ARCH),x86_64)
|
||||||
|
Q3OBJ += $(B)/client/vm_x86_64.o
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(ARCH),ppc)
|
ifeq ($(ARCH),ppc)
|
||||||
ifneq ($(VM_PPC),)
|
ifneq ($(VM_PPC),)
|
||||||
|
@ -902,6 +907,7 @@ $(B)/client/win_wndproc.o : $(W32DIR)/win_wndproc.c; $(DO_CC) $(DX_CFLAGS)
|
||||||
$(B)/client/win_resource.o : $(W32DIR)/winquake.rc; $(DO_WINDRES)
|
$(B)/client/win_resource.o : $(W32DIR)/winquake.rc; $(DO_WINDRES)
|
||||||
|
|
||||||
$(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC)
|
$(B)/client/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_CC)
|
||||||
|
$(B)/client/vm_x86_64.o : $(CMDIR)/vm_x86_64.c; $(DO_CC)
|
||||||
ifneq ($(VM_PPC),)
|
ifneq ($(VM_PPC),)
|
||||||
$(B)/client/$(VM_PPC).o : $(CMDIR)/$(VM_PPC).c; $(DO_CC)
|
$(B)/client/$(VM_PPC).o : $(CMDIR)/$(VM_PPC).c; $(DO_CC)
|
||||||
endif
|
endif
|
||||||
|
@ -989,6 +995,10 @@ ifeq ($(ARCH),i386)
|
||||||
Q3DOBJ += $(B)/ded/vm_x86.o $(B)/ded/ftola.o $(B)/ded/snapvectora.o
|
Q3DOBJ += $(B)/ded/vm_x86.o $(B)/ded/ftola.o $(B)/ded/snapvectora.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ARCH),x86_64)
|
||||||
|
Q3DOBJ += $(B)/ded/vm_x86_64.o
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(ARCH),ppc)
|
ifeq ($(ARCH),ppc)
|
||||||
ifneq ($(VM_PPC),)
|
ifneq ($(VM_PPC),)
|
||||||
Q3DOBJ += $(B)/ded/$(VM_PPC).o
|
Q3DOBJ += $(B)/ded/$(VM_PPC).o
|
||||||
|
@ -1069,6 +1079,7 @@ $(B)/ded/ftola.o : $(UDIR)/ftola.s; $(DO_AS)
|
||||||
$(B)/ded/snapvectora.o : $(UDIR)/snapvectora.s; $(DO_AS)
|
$(B)/ded/snapvectora.o : $(UDIR)/snapvectora.s; $(DO_AS)
|
||||||
|
|
||||||
$(B)/ded/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_DED_CC)
|
$(B)/ded/vm_x86.o : $(CMDIR)/vm_x86.c; $(DO_DED_CC)
|
||||||
|
$(B)/ded/vm_x86_64.o : $(CMDIR)/vm_x86_64.c; $(DO_DED_CC)
|
||||||
ifneq ($(VM_PPC),)
|
ifneq ($(VM_PPC),)
|
||||||
$(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
|
||||||
|
|
|
@ -730,7 +730,6 @@ changed the load procedure to match VFS logic, and allow developer use
|
||||||
#3 look in fs_basepath
|
#3 look in fs_basepath
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
extern char *FS_BuildOSPath( const char *base, const char *game, const char *qpath );
|
|
||||||
|
|
||||||
static void* try_dlopen(const char* base, const char* gamedir, const char* fname, char* fqpath )
|
static void* try_dlopen(const char* base, const char* gamedir, const char* fname, char* fqpath )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue