exec.h revision 4af48bf7c72ef1e201c64bd475377b5af9d8e8a1
/*
* i386 execution defines
*
* Copyright (c) 2003 Fabrice Bellard
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include "dyngen-exec.h"
/* XXX: factorize this mess */
#ifdef TARGET_X86_64
#define TARGET_LONG_BITS 64
#else
#define TARGET_LONG_BITS 32
#endif
#include "cpu-defs.h"
#include "qemu-common.h"
#include "qemu-log.h"
/* float macros */
#include "cpu.h"
#include "exec-all.h"
/* op_helper.c */
void do_smm_enter(void);
/* n must be a constant to be efficient */
{
if (n >= 0)
return x << n;
else
return x >> (-n);
}
#include "helper.h"
{
}
#if !defined(CONFIG_USER_ONLY)
#include "softmmu_exec.h"
#endif /* !defined(CONFIG_USER_ONLY) */
#ifdef USE_X86LDOUBLE
/* use long double functions */
#define floatx_to_int32 floatx80_to_int32
#define floatx_to_int64 floatx80_to_int64
#define int32_to_floatx int32_to_floatx80
#define int64_to_floatx int64_to_floatx80
#define float32_to_floatx float32_to_floatx80
#define float64_to_floatx float64_to_floatx80
#define floatx_to_float32 floatx80_to_float32
#define floatx_to_float64 floatx80_to_float64
#define floatx_abs floatx80_abs
#define floatx_chs floatx80_chs
#define floatx_compare floatx80_compare
#ifdef VBOX
#endif /* !VBOX */
#endif
#else
#define floatx_to_int32 float64_to_int32
#define floatx_to_int64 float64_to_int64
#define int32_to_floatx int32_to_float64
#define int64_to_floatx int64_to_float64
#define float32_to_floatx float32_to_float64
#define float64_to_floatx(x, e) (x)
#define floatx_to_float32 float64_to_float32
#define floatx_to_float64(x, e) (x)
#define floatx_abs float64_abs
#define floatx_chs float64_chs
#define floatx_compare float64_compare
#endif
#ifdef VBOX
#endif /* VBOX */
#define RC_MASK 0xc00
#define RC_NEAR 0x000
#define RC_DOWN 0x400
#define RC_UP 0x800
#define RC_CHOP 0xc00
#define MAXTAN 9223372036854775808.0
#ifdef USE_X86LDOUBLE
/* only for x86 */
typedef union {
long double d;
struct {
unsigned long long lower;
unsigned short upper;
} l;
/* the following deal with x86 long double-precision numbers */
#define MAXEXPD 0x7fff
#define EXPBIAS 16383
#else
/* NOTE: arm is horrible as double 32 bit words are stored in big endian ! */
typedef union {
double d;
#if !defined(WORDS_BIGENDIAN) && !defined(__arm__)
struct {
} l;
#else
struct {
} l;
#endif
#ifndef __arm__
#endif
/* the following deal with IEEE double-precision numbers */
#define MAXEXPD 0x7ff
#define EXPBIAS 1023
#ifdef __arm__
#else
#endif
#endif
static inline void fpush(void)
{
}
static inline void fpop(void)
{
}
#ifndef USE_X86LDOUBLE
{
int upper, e;
/* mantissa */
/* XXX: handle overflow ? */
#ifdef __arm__
#else
#endif
return temp.d;
}
{
int e;
temp.d = f;
/* mantissa */
/* exponent + sign */
}
#else
/* we use memory access macros */
{
return temp.d;
}
{
temp.d = f;
}
#endif /* USE_X86LDOUBLE */
#define FPUS_IE (1 << 0)
#define FPUC_EM 0x3f
static inline uint32_t compute_eflags(void)
{
}
/* NOTE: CC_OP must be modified manually to CC_OP_EFLAGS */
{
}
static inline void env_to_regs(void)
{
#ifdef reg_EAX
#endif
#ifdef reg_ECX
#endif
#ifdef reg_EDX
#endif
#ifdef reg_EBX
#endif
#ifdef reg_ESP
#endif
#ifdef reg_EBP
#endif
#ifdef reg_ESI
#endif
#ifdef reg_EDI
#endif
}
static inline void regs_to_env(void)
{
#ifdef reg_EAX
#endif
#ifdef reg_ECX
#endif
#ifdef reg_EDX
#endif
#ifdef reg_EBX
#endif
#ifdef reg_ESP
#endif
#ifdef reg_EBP
#endif
#ifdef reg_ESI
#endif
#ifdef reg_EDI
#endif
}
/* handle exit of HALTED state */
return 0;
/* disable halt condition */
return 0;
}
return EXCP_HALTED;
}
/* load efer and update the corresponding hflags. XXX: do consistency
checks with cpuid bits ? */
{
}