more Sys_* cleanup

This commit is contained in:
Bill Currie 2002-06-01 03:00:13 +00:00
parent fc0bb7e175
commit 9630a23391
13 changed files with 65 additions and 247 deletions

View file

@ -10,7 +10,7 @@ else
noinst_LTLIBRARIES=
endif
asm_src= math.S
asm_src= math.S sys_ia32.S
libasm_la_SOURCES= $(asm_src)

View file

@ -429,3 +429,30 @@ Sys_DebugLog (const char *file, const char *fmt, ...)
write (fd, data, strlen (data));
close (fd);
}
#ifndef USE_INTEL_ASM
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
void
Sys_SetFPCW (void)
{
}
void
Sys_PushFPCW_SetHigh (void)
{
}
void
Sys_PopFPCW (void)
{
}
#endif

View file

@ -33,19 +33,41 @@
#ifdef USE_INTEL_ASM
#ifdef WIN32
# undef PIC //no such thing in win32
#endif
.data
.align 4
fpenv:
.long 0, 0, 0, 0, 0, 0, 0, 0
#ifdef PIC
#define got_base(n) \
call .Lpic##n ;\
.Lpic##n: ;\
popl %edx ;\
addl $C(_GLOBAL_OFFSET_TABLE_)+[.-.Lpic##n],%edx
#define got_var(v) v@GOT(%edx)
#else
#define got_base(n)
#define got_var(v) v
#endif
.text
.globl C(MaskExceptions)
#ifdef PIC
.type C(MaskExceptions),@function
#endif
C(MaskExceptions):
fnstenv fpenv
got_base(1)
fnstenv got_var(fpenv)
orl $0x3F,fpenv
fldenv fpenv
fldenv got_var(fpenv)
ret
@ -73,44 +95,44 @@ pushed_cw: .long 0
.globl C(Sys_LowFPPrecision)
C(Sys_LowFPPrecision):
fldcw single_cw
fldcw got_var(single_cw)
ret
.globl C(Sys_HighFPPrecision)
C(Sys_HighFPPrecision):
fldcw full_cw
fldcw got_var(full_cw)
ret
.globl C(Sys_PushFPCW_SetHigh)
C(Sys_PushFPCW_SetHigh):
fnstcw pushed_cw
fldcw full_cw
fnstcw got_var(pushed_cw)
fldcw got_var(full_cw)
ret
.globl C(Sys_PopFPCW)
C(Sys_PopFPCW):
fldcw pushed_cw
fldcw got_var(pushed_cw)
ret
.globl C(Sys_SetFPCW)
C(Sys_SetFPCW):
fnstcw cw
movl cw,%eax
fnstcw got_var(cw)
movl got_var(cw),%eax
andb $0xF0,%ah
orb $0x03,%ah // round mode, 64-bit precision
movl %eax,full_cw
movl %eax,got_var(full_cw)
andb $0xF0,%ah
orb $0x0C,%ah // chop mode, single precision
movl %eax,single_cw
movl %eax,got_var(single_cw)
andb $0xF0,%ah
orb $0x08,%ah // ceil mode, single precision
movl %eax,ceil_cw
movl %eax,got_var(ceil_cw)
ret
#endif /* USE_INTEL_ASM */

View file

@ -44,7 +44,7 @@ else
asm=
endif
asm_src= sys_ia32.S worlda.S
asm_src= worlda.S
libasm_la_SOURCES= $(asm_src)

View file

@ -130,18 +130,6 @@ Sys_ConsoleInput (void)
return NULL;
}
#ifndef USE_INTEL_ASM
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
#endif
#ifndef SDL_main
# define SDL_main main
#endif

View file

@ -117,18 +117,6 @@ Sys_ConsoleInput (void)
return NULL;
}
#ifndef USE_INTEL_ASM
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
#endif
int
main (int c, const char *v[])
{

View file

@ -110,19 +110,6 @@ Sys_ConsoleInput (void)
return NULL;
}
#ifndef USE_INTEL_ASM
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
#endif
int
main (int argc, const char **argv)
{

View file

@ -97,28 +97,12 @@ findhandle (void)
// SYSTEM IO ==================================================================
#ifndef USE_INTEL_ASM
void
Sys_SetFPCW (void)
{
}
void
Sys_PushFPCW_SetHigh (void)
{
}
void
Sys_PopFPCW (void)
{
}
void
MaskExceptions (void)
{
}
#endif
void

View file

@ -47,31 +47,6 @@ static const char rcsid[] =
qboolean isDedicated = true;
#if 0
// FILE IO ====================================================================
#define MAX_HANDLES 10
VFile *sys_handles[MAX_HANDLES];
// SYSTEM IO ==================================================================
void
IN_SendKeyEvents (void)
{
}
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
#endif
const char *
Sys_ConsoleInput (void)
{

View file

@ -45,7 +45,7 @@ else
asm=
endif
asm_src= sys_x86.S worlda.S
asm_src= worlda.S
libasm_la_SOURCES= $(asm_src)

View file

@ -115,18 +115,6 @@ shutdown (void)
#endif
}
#ifndef USE_INTEL_ASM
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
#endif
#ifndef SDL_main
# define SDL_main main
#endif

View file

@ -78,37 +78,12 @@ shutdown (void)
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
}
void
Sys_Warn (char *warning, ...)
{
va_list argptr;
char string[1024];
va_start (argptr, warning);
vsnprintf (string, sizeof (string), warning, argptr);
va_end (argptr);
fprintf (stderr, "Warning: %s", string);
}
void
floating_point_exception_handler (int whatever)
{
// Sys_Warn("floating point exception\n");
signal (SIGFPE, floating_point_exception_handler);
}
#ifndef USE_INTEL_ASM
void
Sys_HighFPPrecision (void)
{
}
void
Sys_LowFPPrecision (void)
{
}
#endif
int skipframes;
int

View file

@ -1,116 +0,0 @@
/*
sys_x86.S
x86 assembly-language dependent routines.
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "asm_i386.h"
#ifdef USE_INTEL_ASM
.data
.align 4
fpenv:
.long 0, 0, 0, 0, 0, 0, 0, 0
.text
.globl C(MaskExceptions)
C(MaskExceptions):
fnstenv fpenv
orl $0x3F,fpenv
fldenv fpenv
ret
#if 0
.globl C(unmaskexceptions)
C(unmaskexceptions):
fnstenv fpenv
andl $0xFFFFFFE0,fpenv
fldenv fpenv
ret
#endif
.data
.align 4
.globl ceil_cw, single_cw, full_cw, cw, pushed_cw
ceil_cw: .long 0
single_cw: .long 0
full_cw: .long 0
cw: .long 0
pushed_cw: .long 0
.text
.globl C(Sys_LowFPPrecision)
C(Sys_LowFPPrecision):
fldcw single_cw
ret
.globl C(Sys_HighFPPrecision)
C(Sys_HighFPPrecision):
fldcw full_cw
ret
.globl C(Sys_PushFPCW_SetHigh)
C(Sys_PushFPCW_SetHigh):
fnstcw pushed_cw
fldcw full_cw
ret
.globl C(Sys_PopFPCW)
C(Sys_PopFPCW):
fldcw pushed_cw
ret
.globl C(Sys_SetFPCW)
C(Sys_SetFPCW):
fnstcw cw
movl cw,%eax
andb $0xF0,%ah
orb $0x03,%ah // round mode, 64-bit precision
movl %eax,full_cw
andb $0xF0,%ah
orb $0x0C,%ah // chop mode, single precision
movl %eax,single_cw
andb $0xF0,%ah
orb $0x08,%ah // ceil mode, single precision
movl %eax,ceil_cw
ret
#endif /* USE_INTEL_ASM */