- Applied const64bit patch:

For compilers (such as Microsoft VC++) which don't allow "LL" after a
  constant to make it 64-bit, this patch declares all such constants as
  BX_CONST64(value).  Then in config.in, a switch called
  BX_64BIT_CONSTANTS_USE_LL controls whether the macro puts the
  LL's in or not.  Configure sets the macro, if you're on a platform
  that can run such things.
This commit is contained in:
Bryce Denney 2001-04-10 02:06:10 +00:00
parent 9126941a36
commit a6ad4c3903
13 changed files with 139 additions and 94 deletions

View File

@ -273,6 +273,14 @@
#define SIZEOF_UNSIGNED_LONG_LONG 0
#define SIZEOF_INT_P 0
#define BX_64BIT_CONSTANTS_USE_LL 1
#if BX_64BIT_CONSTANTS_USE_LL
// doesn't work on Microsoft Visual C++, maybe others
#define BX_CONST64(x) (x##LL)
#else
#define BX_CONST64(x) (x)
#endif
#if BX_WITH_WIN32
typedef unsigned char Bit8u;
typedef signed char Bit8s;

58
bochs/configure vendored
View File

@ -2640,8 +2640,36 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking if compiler allows LL for 64-bit constants""... $ac_c" 1>&6
echo "configure:2645: checking if compiler allows LL for 64-bit constants" >&5
cat > conftest.$ac_ext <<EOF
#line 2647 "configure"
#include "confdefs.h"
int main() {
{ 42LL; }
; return 0; }
EOF
if { (eval echo configure:2654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
cat >> confdefs.h <<\EOF
#define BX_64BIT_CONSTANTS_USE_LL 0
EOF
fi
rm -f conftest*
echo $ac_n "checking for cpu level""... $ac_c" 1>&6
echo "configure:2645: checking for cpu level" >&5
echo "configure:2673: checking for cpu level" >&5
# Check whether --enable-cpu-level or --disable-cpu-level was given.
if test "${enable_cpu_level+set}" = set; then
enableval="$enable_cpu_level"
@ -2704,7 +2732,7 @@ fi
echo $ac_n "checking for dynamic translation support""... $ac_c" 1>&6
echo "configure:2708: checking for dynamic translation support" >&5
echo "configure:2736: checking for dynamic translation support" >&5
# Check whether --enable-dynamic or --disable-dynamic was given.
if test "${enable_dynamic+set}" = set; then
enableval="$enable_dynamic"
@ -2777,7 +2805,7 @@ fi
echo $ac_n "checking for NE2000 support""... $ac_c" 1>&6
echo "configure:2781: checking for NE2000 support" >&5
echo "configure:2809: checking for NE2000 support" >&5
# Check whether --enable-ne2000 or --disable-ne2000 was given.
if test "${enable_ne2000+set}" = set; then
enableval="$enable_ne2000"
@ -2812,7 +2840,7 @@ fi
echo $ac_n "checking for i440FX PCI support""... $ac_c" 1>&6
echo "configure:2816: checking for i440FX PCI support" >&5
echo "configure:2844: checking for i440FX PCI support" >&5
# Check whether --enable-pci or --disable-pci was given.
if test "${enable_pci+set}" = set; then
enableval="$enable_pci"
@ -2847,7 +2875,7 @@ fi
echo $ac_n "checking for port e9 hack""... $ac_c" 1>&6
echo "configure:2851: checking for port e9 hack" >&5
echo "configure:2879: checking for port e9 hack" >&5
# Check whether --enable-port-e9-hack or --disable-port-e9-hack was given.
if test "${enable_port_e9_hack+set}" = set; then
enableval="$enable_port_e9_hack"
@ -2878,7 +2906,7 @@ fi
echo $ac_n "checking for use of .cpp as suffix""... $ac_c" 1>&6
echo "configure:2882: checking for use of .cpp as suffix" >&5
echo "configure:2910: checking for use of .cpp as suffix" >&5
# Check whether --enable-cpp or --disable-cpp was given.
if test "${enable_cpp+set}" = set; then
enableval="$enable_cpp"
@ -2920,7 +2948,7 @@ fi
echo $ac_n "checking for Bochs internal debugger support""... $ac_c" 1>&6
echo "configure:2924: checking for Bochs internal debugger support" >&5
echo "configure:2952: checking for Bochs internal debugger support" >&5
# Check whether --enable-debugger or --disable-debugger was given.
if test "${enable_debugger+set}" = set; then
enableval="$enable_debugger"
@ -2958,7 +2986,7 @@ fi
echo $ac_n "checking for disassembler support""... $ac_c" 1>&6
echo "configure:2962: checking for disassembler support" >&5
echo "configure:2990: checking for disassembler support" >&5
# Check whether --enable-disasm or --disable-disasm was given.
if test "${enable_disasm+set}" = set; then
enableval="$enable_disasm"
@ -3005,7 +3033,7 @@ fi
echo $ac_n "checking for loader support""... $ac_c" 1>&6
echo "configure:3009: checking for loader support" >&5
echo "configure:3037: checking for loader support" >&5
# Check whether --enable-loader or --disable-loader was given.
if test "${enable_loader+set}" = set; then
enableval="$enable_loader"
@ -3043,7 +3071,7 @@ fi
INSTRUMENT_DIR='instrument/stubs'
echo $ac_n "checking for instrumentation support""... $ac_c" 1>&6
echo "configure:3047: checking for instrumentation support" >&5
echo "configure:3075: checking for instrumentation support" >&5
# Check whether --enable-instrumentation or --disable-instrumentation was given.
if test "${enable_instrumentation+set}" = set; then
enableval="$enable_instrumentation"
@ -3178,7 +3206,7 @@ fi
echo $ac_n "checking for VGA emulation""... $ac_c" 1>&6
echo "configure:3182: checking for VGA emulation" >&5
echo "configure:3210: checking for VGA emulation" >&5
# Check whether --enable-vga or --disable-vga was given.
if test "${enable_vga+set}" = set; then
enableval="$enable_vga"
@ -3212,7 +3240,7 @@ fi
echo $ac_n "checking for FPU emulation""... $ac_c" 1>&6
echo "configure:3216: checking for FPU emulation" >&5
echo "configure:3244: checking for FPU emulation" >&5
FPU_VAR=''
FPU_GLUE_OBJ=''
# Check whether --enable-fpu or --disable-fpu was given.
@ -3254,7 +3282,7 @@ fi
echo $ac_n "checking for x86 debugger support""... $ac_c" 1>&6
echo "configure:3258: checking for x86 debugger support" >&5
echo "configure:3286: checking for x86 debugger support" >&5
# Check whether --enable-x86-debugger or --disable-x86-debugger was given.
if test "${enable_x86_debugger+set}" = set; then
enableval="$enable_x86_debugger"
@ -3290,7 +3318,7 @@ fi
echo $ac_n "checking for CDROM support""... $ac_c" 1>&6
echo "configure:3294: checking for CDROM support" >&5
echo "configure:3322: checking for CDROM support" >&5
# Check whether --enable-cdrom or --disable-cdrom was given.
if test "${enable_cdrom+set}" = set; then
enableval="$enable_cdrom"
@ -3332,7 +3360,7 @@ fi
echo $ac_n "checking for Sound Blaster 16 support""... $ac_c" 1>&6
echo "configure:3336: checking for Sound Blaster 16 support" >&5
echo "configure:3364: checking for Sound Blaster 16 support" >&5
# Check whether --enable-sb16 or --disable-sb16 was given.
if test "${enable_sb16+set}" = set; then
enableval="$enable_sb16"

View File

@ -61,6 +61,15 @@ AC_TRY_COMPILE([], [ { label1: } ],
])
AC_LANG_RESTORE
AC_MSG_CHECKING(if compiler allows LL for 64-bit constants)
AC_TRY_COMPILE([], [ { 42LL; } ],
AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_64BIT_CONSTANTS_USE_LL, 0)
])
AC_LANG_RESTORE
AC_MSG_CHECKING(for cpu level)
AC_ARG_ENABLE(cpu-level,
[ --enable-cpu-level select cpu level (3,4,5)],

View File

@ -18,8 +18,8 @@
+---------------------------------------------------------------------------*/
#include <linux/signal.h>
#include <asm/uaccess.h>
#include <stdio.h>
#include "fpu_emu.h"
#include "fpu_system.h"
@ -654,13 +654,13 @@ asmlinkage int arith_round_overflow(FPU_REG *dest, u8 sign)
{
case 01:
case PR_64_BITS:
significand(dest) = 0xffffffffffffffffLL;
significand(dest) = BX_CONST64(0xffffffffffffffff);
break;
case PR_53_BITS:
significand(dest) = 0xfffffffffffff800LL;
significand(dest) = BX_CONST64(0xfffffffffffff800);
break;
case PR_24_BITS:
significand(dest) = 0xffffff0000000000LL;
significand(dest) = BX_CONST64(0xffffff0000000000);
break;
}
}

View File

@ -707,7 +707,7 @@ static int f_cos(FPU_REG *st0_ptr, u_char tag)
{
if ( (exponent(st0_ptr) < 0)
|| ((exponent(st0_ptr) == 0)
&& (significand(st0_ptr) <= 0xc90fdaa22168c234LL)) )
&& (significand(st0_ptr) <= BX_CONST64(0xc90fdaa22168c234))) )
{
poly_cos(st0_ptr);

View File

@ -21,17 +21,17 @@
#define HIPOWER 11
static const u64 lterms[HIPOWER] =
{
0x0000000000000000LL, /* This term done separately as 12 bytes */
0xf5fdeffc162c7543LL,
0x1c6b08d704a0bfa6LL,
0x0276556df749cc21LL,
0x002bb0ffcf14f6b8LL,
0x0002861225ef751cLL,
0x00001ffcbfcd5422LL,
0x00000162c005d5f1LL,
0x0000000da96ccb1bLL,
0x0000000078d1b897LL,
0x000000000422b029LL
BX_CONST64(0x0000000000000000), /* This term done separately as 12 bytes */
BX_CONST64(0xf5fdeffc162c7543),
BX_CONST64(0x1c6b08d704a0bfa6),
BX_CONST64(0x0276556df749cc21),
BX_CONST64(0x002bb0ffcf14f6b8),
BX_CONST64(0x0002861225ef751c),
BX_CONST64(0x00001ffcbfcd5422),
BX_CONST64(0x00000162c005d5f1),
BX_CONST64(0x0000000da96ccb1b),
BX_CONST64(0x0000000078d1b897),
BX_CONST64(0x000000000422b029)
};
static const Xsig hiterm = MK_XSIG(0xb17217f7, 0xd1cf79ab, 0xc8a39194);

View File

@ -21,27 +21,27 @@
#define HIPOWERon 6 /* odd poly, negative terms */
static const u64 oddnegterms[HIPOWERon] =
{
0x0000000000000000LL, /* Dummy (not for - 1.0) */
0x015328437f756467LL,
0x0005dda27b73dec6LL,
0x0000226bf2bfb91aLL,
0x000000ccc439c5f7LL,
0x0000000355438407LL
BX_CONST64(0x0000000000000000), /* Dummy (not for - 1.0) */
BX_CONST64(0x015328437f756467),
BX_CONST64(0x0005dda27b73dec6),
BX_CONST64(0x0000226bf2bfb91a),
BX_CONST64(0x000000ccc439c5f7),
BX_CONST64(0x0000000355438407)
} ;
#define HIPOWERop 6 /* odd poly, positive terms */
static const u64 oddplterms[HIPOWERop] =
{
/* 0xaaaaaaaaaaaaaaabLL, transferred to fixedpterm[] */
0x0db55a71875c9ac2LL,
0x0029fce2d67880b0LL,
0x0000dfd3908b4596LL,
0x00000550fd61dab4LL,
0x0000001c9422b3f9LL,
0x000000003e3301e1LL
/* BX_CONST64(0xaaaaaaaaaaaaaaab), transferred to fixedpterm[] */
BX_CONST64(0x0db55a71875c9ac2),
BX_CONST64(0x0029fce2d67880b0),
BX_CONST64(0x0000dfd3908b4596),
BX_CONST64(0x00000550fd61dab4),
BX_CONST64(0x0000001c9422b3f9),
BX_CONST64(0x000000003e3301e1)
};
static const u64 denomterm = 0xebd9b842c5c53a0eLL;
static const u64 denomterm = BX_CONST64(0xebd9b842c5c53a0e);
static const Xsig fixedpterm = MK_XSIG(0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa);

View File

@ -181,16 +181,16 @@ int poly_l2p1(u_char sign0, u_char sign1,
#define HIPOWER 10
static const u64 logterms[HIPOWER] =
{
0x2a8eca5705fc2ef0LL,
0xf6384ee1d01febceLL,
0x093bb62877cdf642LL,
0x006985d8a9ec439bLL,
0x0005212c4f55a9c8LL,
0x00004326a16927f0LL,
0x0000038d1d80a0e7LL,
0x0000003141cc80c6LL,
0x00000002b1668c9fLL,
0x000000002c7a46aaLL
BX_CONST64(0x2a8eca5705fc2ef0),
BX_CONST64(0xf6384ee1d01febce),
BX_CONST64(0x093bb62877cdf642),
BX_CONST64(0x006985d8a9ec439b),
BX_CONST64(0x0005212c4f55a9c8),
BX_CONST64(0x00004326a16927f0),
BX_CONST64(0x0000038d1d80a0e7),
BX_CONST64(0x0000003141cc80c6),
BX_CONST64(0x00000002b1668c9f),
BX_CONST64(0x000000002c7a46aa)
};
static const u32 leadterm = 0xb8000000;

View File

@ -25,18 +25,18 @@
static const u64 pos_terms_l[N_COEFF_P] =
{
0xaaaaaaaaaaaaaaabLL,
0x00d00d00d00cf906LL,
0x000006b99159a8bbLL,
0x000000000d7392e6LL
BX_CONST64(0xaaaaaaaaaaaaaaab),
BX_CONST64(0x00d00d00d00cf906),
BX_CONST64(0x000006b99159a8bb),
BX_CONST64(0x000000000d7392e6)
};
static const u64 neg_terms_l[N_COEFF_N] =
{
0x2222222222222167LL,
0x0002e3bc74aab624LL,
0x0000000b09229062LL,
0x00000000000c7973LL
BX_CONST64(0x2222222222222167),
BX_CONST64(0x0002e3bc74aab624),
BX_CONST64(0x0000000b09229062),
BX_CONST64(0x00000000000c7973)
};
@ -45,18 +45,18 @@ static const u64 neg_terms_l[N_COEFF_N] =
#define N_COEFF_NH 4
static const u64 pos_terms_h[N_COEFF_PH] =
{
0x0000000000000000LL,
0x05b05b05b05b0406LL,
0x000049f93edd91a9LL,
0x00000000c9c9ed62LL
BX_CONST64(0x0000000000000000),
BX_CONST64(0x05b05b05b05b0406),
BX_CONST64(0x000049f93edd91a9),
BX_CONST64(0x00000000c9c9ed62)
};
static const u64 neg_terms_h[N_COEFF_NH] =
{
0xaaaaaaaaaaaaaa98LL,
0x001a01a01a019064LL,
0x0000008f76c68a77LL,
0x0000000000d58f5eLL
BX_CONST64(0xaaaaaaaaaaaaaa98),
BX_CONST64(0x001a01a01a019064),
BX_CONST64(0x0000008f76c68a77),
BX_CONST64(0x0000000000d58f5e)
};
@ -131,9 +131,9 @@ void poly_sine(FPU_REG *st0_ptr)
fixed_arg <<= 1;
}
/* pi/2 in hex is: 1.921fb54442d18469 898CC51701B839A2 52049C1 */
fixed_arg = 0x921fb54442d18469LL - fixed_arg;
fixed_arg = BX_CONST64(0x921fb54442d18469) - fixed_arg;
/* There is a special case which arises due to rounding, to fix here. */
if ( fixed_arg == 0xffffffffffffffffLL )
if ( fixed_arg == BX_CONST64(0xffffffffffffffff))
fixed_arg = 0;
XSIG_LL(argSqrd) = fixed_arg; argSqrd.lsw = 0;
@ -195,7 +195,7 @@ void poly_sine(FPU_REG *st0_ptr)
#ifdef PARANOID
if ( (exponent(&result) >= 0)
&& (significand(&result) > 0x8000000000000000LL) )
&& (significand(&result) > BX_CONST64(0x8000000000000000)) )
{
EXCEPTION(EX_INTERNAL|0x150);
}
@ -218,7 +218,7 @@ void poly_cos(FPU_REG *st0_ptr)
#ifdef PARANOID
if ( (exponent(st0_ptr) > 0)
|| ((exponent(st0_ptr) == 0)
&& (significand(st0_ptr) > 0xc90fdaa22168c234LL)) )
&& (significand(st0_ptr) > BX_CONST64(0xc90fdaa22168c234))) )
{
EXCEPTION(EX_Invalid);
FPU_copy_to_reg0(&CONST_QNaN, TAG_Special);
@ -300,9 +300,9 @@ void poly_cos(FPU_REG *st0_ptr)
fixed_arg <<= 1;
}
/* pi/2 in hex is: 1.921fb54442d18469 898CC51701B839A2 52049C1 */
fixed_arg = 0x921fb54442d18469LL - fixed_arg;
fixed_arg = BX_CONST64(0x921fb54442d18469) - fixed_arg;
/* There is a special case which arises due to rounding, to fix here. */
if ( fixed_arg == 0xffffffffffffffffLL )
if ( fixed_arg == BX_CONST64(0xffffffffffffffff))
fixed_arg = 0;
exponent = -1;
@ -360,7 +360,7 @@ void poly_cos(FPU_REG *st0_ptr)
*/
/* This has an exponent of -65 */
XSIG_LL(fix_up) = 0x898cc51701b839a2ll;
XSIG_LL(fix_up) = BX_CONST64(0x898cc51701b839a2);
fix_up.lsw = 0;
/* The fix-up needs to be improved for larger args */
@ -388,7 +388,7 @@ void poly_cos(FPU_REG *st0_ptr)
#ifdef PARANOID
if ( (exponent(&result) >= 0)
&& (significand(&result) > 0x8000000000000000LL) )
&& (significand(&result) > BX_CONST64(0x8000000000000000)) )
{
EXCEPTION(EX_INTERNAL|0x151);
}

View File

@ -22,33 +22,33 @@
#define HiPOWERop 3 /* odd poly, positive terms */
static const u64 oddplterm[HiPOWERop] =
{
0x0000000000000000LL,
0x0051a1cf08fca228LL,
0x0000000071284ff7LL
BX_CONST64(0x0000000000000000),
BX_CONST64(0x0051a1cf08fca228),
BX_CONST64(0x0000000071284ff7)
};
#define HiPOWERon 2 /* odd poly, negative terms */
static const u64 oddnegterm[HiPOWERon] =
{
0x1291a9a184244e80LL,
0x0000583245819c21LL
BX_CONST64(0x1291a9a184244e80),
BX_CONST64(0x0000583245819c21)
};
#define HiPOWERep 2 /* even poly, positive terms */
static const u64 evenplterm[HiPOWERep] =
{
0x0e848884b539e888LL,
0x00003c7f18b887daLL
BX_CONST64(0x0e848884b539e888),
BX_CONST64(0x00003c7f18b887da)
};
#define HiPOWERen 2 /* even poly, negative terms */
static const u64 evennegterm[HiPOWERen] =
{
0xf1f0200fd51569ccLL,
0x003afb46105c4432LL
BX_CONST64(0xf1f0200fd51569cc),
BX_CONST64(0x003afb46105c4432)
};
static const u64 twothirds = 0xaaaaaaaaaaaaaaabLL;
static const u64 twothirds = BX_CONST64(0xaaaaaaaaaaaaaaab);
/*--- poly_tan() ------------------------------------------------------------+
@ -121,7 +121,7 @@ void poly_tan(FPU_REG *st0_ptr, int invert)
really doesn't matter what value we use because it will
have negligible effect in later calculations
*/
XSIG_LL(accum) = 0x8000000000000000LL;
XSIG_LL(accum) = BX_CONST64(0x8000000000000000);
accum.lsw = 0;
}
else

View File

@ -913,7 +913,7 @@ int FPU_store_int64(FPU_REG *st0_ptr, u_char st0_tag, s64 *d)
if ( control_word & EX_Invalid )
{
/* Produce something like QNaN "indefinite" */
tll = 0x8000000000000000LL;
tll = BX_CONST64(0x8000000000000000);
}
else
return 0;

View File

@ -72,10 +72,10 @@ int FPU_u_mul(const FPU_REG *a, const FPU_REG *b, FPU_REG *c, u16 cw,
c->exp = expon;
if ( ! (mu & 0x8000000000000000LL) )
if ( ! (mu & BX_CONST64(0x8000000000000000)) )
{
mu <<= 1;
if ( ml & 0x8000000000000000LL )
if ( ml & BX_CONST64(0x8000000000000000) )
mu |= 1;
ml <<= 1;
c->exp --;

View File

@ -87,7 +87,7 @@ int wm_sqrt(FPU_REG *n, s32 dummy1, s32 dummy2, u16 control_w, u8 sign)
work += ((u64)guess32) << 32;
if ( work == 0 ) /* This happens in one or two special cases */
work = 0xffffffffffffffffLL;
work = BX_CONST64(0xffffffffffffffff);
guess = work;