Added first stubs for XSAVE/XRESTOR implementation

Disassemble XSAVE/XRSTOR instructions (4 instructions)
Update CHANGES - a bit speculatively
This commit is contained in:
Stanislav Shwartsman 2008-02-12 22:41:39 +00:00
parent 680a588575
commit 8615022962
13 changed files with 1579 additions and 1375 deletions

View File

@ -1,3 +1,71 @@
Changes after 2.3.6 release:
Brief summary :
+ More optimizations in CPU code - 20% additional emulation speedup
over 2.3.6 release!
Detailed change log :
- CPU
- Support of XSAVE/XRSTOR CPU extensions, to enable configure with
--enable-xsave option
- Fixed Bochs failure on RISC host machines with BxRepeatSpeedups
optimization enabled
- Minor bugfixes in CPU emulation (both ia32 and x86-64)
- Updated CPU instrumentation callbacks
- System BIOS (Volker)
- Implemented LBA48 support (since BIOS functions are limited to
32 bit, the max. disk size is now 2 TB)
- Added generation of SSDT ACPI table that contains definitions
for available processors
- Added RTC device to ACPI DSDT table
- Added implementation of SMBIOS
- I/O devices (Volker)
- VGA
- Implemented screen disable bit in sequencer register #1
- Implemented text mode cursor blinking
- Configure and compile
- Removed --enable-magic-breakpoint configure option. The option is
automatically enabled if Bochs internal debugger is compiled in.
It is still possible to turn on/off the feature through .bochsrc.
- Allow boot from network option in .bochsrc
- Added Bochs version info for Win32
- SF patches applied
[1889851] Win32 version information FILEVERSION for bochs.exe by Sebastian
[1889042] rombios.c - fix comment by Sebastian
[1881500] bochsrc, allow boot: network by Sebastian
[1880755] Win32 version information for bochs.exe by Sebastian
[1880471] SMBIOS fix type 0 by Sebastian
[1878558] SMBIOS fixes by Sebastian
[1864692] SMBIOS support by Filip Navara
[1865105] Move bios_table_area_end to 0xcc00 by Sebastian
[1875414] Makefile.in - change make use by Sebastian
[1874276] Added instrumentation for sysenter/sysexit by Lluis
[1873221] TLB page flush: add logical address to instrumentation by Lluis
[1830626] lba32 support by Samuel Thibault
[1861839] Move option rom scan after floppy and hard drive post by Sebastian
[1838283] Early vga bios init by Sebastian
[1838272] rom_scan range parameter by Sebastian
[1864680] Save CPUID signature by Filip Navara
- these S.F. bugs were closed
[1569256] bug in datasegment change in long mode
[1830662] ACPI: no DMI BIOS year, acpi=force is required
[1868806] VGA blink enable & screen disable
[1875721] Bit "Accessed" in LDT/GDT descriptors & #PF
[1874124] bx_Instruction_c::ilen() const
[1873488] bochs-2.3.6 make fails on dbg_main.cc
- these S.F. feature requests were implemented
[1847955] Version information for bochs(dbg).exe
[939797] SMBIOS support
-------------------------------------------------------------------------
Changes in 2.3.6 (December 24, 2007):
Brief summary :
@ -63,6 +131,7 @@ Detailed change log :
--cpu-level >= 4 (like in real hardware)
- SF patches applied
[1491207] Trace Cache Speedup patch by Stanislav
[1857149] Define some IPL values by Sebastian
[1850183] Get memory access mode in BX_INSTR_LIN_READ by Lluis Vilanova
[1841421] pic: keep slave_pic.INT and master_pic.IRQ_in bit 2 in sync by Russ Cox

View File

@ -720,8 +720,9 @@ typedef
#define BX_SUPPORT_VME 0
#define BX_SUPPORT_POPCNT 0
#define BX_SUPPORT_MONITOR_MWAIT 0
#define BX_SUPPORT_MTRR 0
#define BX_SUPPORT_XSAVE 0
#define BX_SUPPORT_MTRR 0
#define BX_SUPPORT_LARGE_PAGES 0
#define BX_SUPPORT_GLOBAL_PAGES 0
#define BX_SUPPORT_PAE 0

100
bochs/configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in,v 1.360 2008/02/05 22:57:39 sshwarts Exp .
# From configure.in Id: configure.in,v 1.361 2008/02/09 07:51:11 sshwarts Exp .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.60.
#
@ -1579,6 +1579,7 @@ Optional Features:
--enable-sse SSE support (--enable-sse=no|1|2|3|4)
--enable-sse-extension support for SSE extensions
--enable-daz denormals-are-zeroes support
--enable-xsave support for XSAVE/XRSTOR extensions
--enable-alignment-check alignment check (#AC) support
--enable-misaligned-sse misaligned SSE support
--enable-sep SYSENTER/SYSEXIT support
@ -4503,7 +4504,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 4506 "configure"' > conftest.$ac_ext
echo '#line 4507 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -6869,11 +6870,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:6872: $lt_compile\"" >&5)
(eval echo "\"\$as_me:6873: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:6876: \$? = $ac_status" >&5
echo "$as_me:6877: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -7102,11 +7103,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7105: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7106: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7109: \$? = $ac_status" >&5
echo "$as_me:7110: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -7169,11 +7170,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7172: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7173: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:7176: \$? = $ac_status" >&5
echo "$as_me:7177: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -9442,7 +9443,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 9445 "configure"
#line 9446 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -9540,7 +9541,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 9543 "configure"
#line 9544 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11747,11 +11748,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11750: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11751: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:11754: \$? = $ac_status" >&5
echo "$as_me:11755: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -11814,11 +11815,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:11817: $lt_compile\"" >&5)
(eval echo "\"\$as_me:11818: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:11821: \$? = $ac_status" >&5
echo "$as_me:11822: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -13236,7 +13237,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 13239 "configure"
#line 13240 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -13334,7 +13335,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 13337 "configure"
#line 13338 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -14157,11 +14158,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14160: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14161: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14164: \$? = $ac_status" >&5
echo "$as_me:14165: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -14224,11 +14225,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14227: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14228: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:14231: \$? = $ac_status" >&5
echo "$as_me:14232: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -16267,11 +16268,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16270: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16271: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:16274: \$? = $ac_status" >&5
echo "$as_me:16275: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -16500,11 +16501,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16503: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16504: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:16507: \$? = $ac_status" >&5
echo "$as_me:16508: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
@ -16567,11 +16568,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16570: $lt_compile\"" >&5)
(eval echo "\"\$as_me:16571: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:16574: \$? = $ac_status" >&5
echo "$as_me:16575: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@ -18840,7 +18841,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 18843 "configure"
#line 18844 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -18938,7 +18939,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 18941 "configure"
#line 18942 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -21319,7 +21320,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 21322 "configure"
#line 21323 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -39260,6 +39261,47 @@ _ACEOF
fi
use_xsave=0
{ echo "$as_me:$LINENO: checking for XSAVE/XRSTOR support" >&5
echo $ECHO_N "checking for XSAVE/XRSTOR support... $ECHO_C" >&6; }
# Check whether --enable-xsave was given.
if test "${enable_xsave+set}" = set; then
enableval=$enable_xsave; if test "$enableval" = yes; then
{ echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_XSAVE 1
_ACEOF
use_xsave=1
elif test "$enableval" = no; then
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_XSAVE 0
_ACEOF
fi
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
cat >>confdefs.h <<\_ACEOF
#define BX_SUPPORT_XSAVE 0
_ACEOF
fi
if test "$support_sse" -lt 1 -a "$use_xsave" = 1; then
{ { echo "$as_me:$LINENO: error: XSAVE requires SSE support!" >&5
echo "$as_me: error: XSAVE requires SSE support!" >&2;}
{ (exit 1); exit 1; }; }
fi
{ echo "$as_me:$LINENO: checking for alignment check support" >&5
echo $ECHO_N "checking for alignment check support... $ECHO_C" >&6; }
# Check whether --enable-alignment-check was given.

View File

@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in,v 1.361 2008-02-09 07:51:11 sshwarts Exp $]])
AC_REVISION([[$Id: configure.in,v 1.362 2008-02-12 22:41:37 sshwarts Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -1675,6 +1675,29 @@ AC_ARG_ENABLE(daz,
]
)
use_xsave=0
AC_MSG_CHECKING(for XSAVE/XRSTOR support)
AC_ARG_ENABLE(xsave,
[ --enable-xsave support for XSAVE/XRSTOR extensions],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_XSAVE, 1)
use_xsave=1
elif test "$enableval" = no; then
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_XSAVE, 0)
fi
],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_XSAVE, 0)
]
)
if test "$support_sse" -lt 1 -a "$use_xsave" = 1; then
AC_MSG_ERROR([XSAVE requires SSE support!])
fi
AC_MSG_CHECKING(for alignment check support)
AC_ARG_ENABLE(alignment-check,
[ --enable-alignment-check alignment check (#AC) support],

View File

@ -69,6 +69,7 @@ OBJS = \
sse_pfp.o \
sse_rcp.o \
sse_string.o \
xsave.o \
soft_int.o \
io_pro.o \
apic.o \
@ -780,7 +781,16 @@ sse_string.o: sse_string.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../cpu/lazy_flags.h ../disasm/disasm.h ../config.h \
crregs.h descriptor.h icache.h apic.h ../cpu/i387.h ../fpu/softfloat.h \
../config.h ../fpu/tag_w.h ../fpu/status_w.h ../fpu/control_w.h \
../cpu/xmm.h ../fpu/softfloat-specialize.h ../fpu/softfloat.h
../cpu/xmm.h
xsave.o: xsave.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \
../extplugin.h ../gui/gui.h ../gui/textconfig.h ../config.h \
../gui/keymap.h ../instrument/stubs/instrument.h cpu.h instr.h \
../cpu/lazy_flags.h ../disasm/disasm.h ../config.h \
crregs.h descriptor.h icache.h apic.h ../cpu/i387.h ../fpu/softfloat.h \
../config.h ../fpu/tag_w.h ../fpu/status_w.h ../fpu/control_w.h \
../cpu/xmm.h
stack16.o: stack16.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h \
../bx_debug/debug.h ../config.h ../osdep.h ../bxversion.h \
../gui/siminterface.h ../memory/memory.h ../pc_system.h ../plugin.h \

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.422 2008-02-11 20:52:10 sshwarts Exp $
// $Id: cpu.h,v 1.423 2008-02-12 22:41:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2261,6 +2261,13 @@ public: // for now...
BX_SMF void INSERTQ_VdqUdq(bxInstruction_c *);
/* SSE4A */
/* XSAVE/XRSTOR extensions */
BX_SMF void XSAVE(bxInstruction_c *);
BX_SMF void XRSTOR(bxInstruction_c *);
BX_SMF void XGETBV(bxInstruction_c *);
BX_SMF void XSETBV(bxInstruction_c *);
/* XSAVE/XRSTOR extensions */
/*** Duplicate SSE instructions ***/
// Although in implementation, these instructions are aliased to the
// another function, it's nice to have them call a separate function when

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: crregs.h,v 1.5 2007-11-17 23:28:31 sshwarts Exp $
// $Id: crregs.h,v 1.6 2008-02-12 22:41:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2007 Stanislav Shwartsman
@ -90,6 +90,9 @@ struct bx_cr4_t {
IMPLEMENT_CRREG_ACCESSORS(PCE, 8);
IMPLEMENT_CRREG_ACCESSORS(OSFXSR, 9);
IMPLEMENT_CRREG_ACCESSORS(OSXMMEXCPT, 10);
#if BX_SUPPORT_XSAVE
IMPLEMENT_CRREG_ACCESSORS(OSXSAVE, 18);
#endif
BX_CPP_INLINE Bit32u getRegister() { return val32; }
BX_CPP_INLINE void setRegister(Bit32u val) { val32 = val; }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.h,v 1.52 2008-02-02 21:46:51 sshwarts Exp $
// $Id: fetchdecode.h,v 1.53 2008-02-12 22:41:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2005 Stanislav Shwartsman
@ -3059,10 +3059,21 @@ static const BxOpcodeInfo_t opcodesGroupRmMONITOR[8] = {
/* 7 */ { 0, &BX_CPU_C::BxError }
};
static const BxOpcodeInfo_t opcodesGroupRmXGETSET[8] = {
/* 0 */ { 0, &BX_CPU_C::XGETBV },
/* 1 */ { 0, &BX_CPU_C::XSETBV },
/* 2 */ { 0, &BX_CPU_C::BxError },
/* 3 */ { 0, &BX_CPU_C::BxError },
/* 4 */ { 0, &BX_CPU_C::BxError },
/* 5 */ { 0, &BX_CPU_C::BxError },
/* 6 */ { 0, &BX_CPU_C::BxError },
/* 7 */ { 0, &BX_CPU_C::BxError }
};
static const BxOpcodeInfo_t BxOpcodeInfoG7R[8] = {
/* 0 */ { 0, &BX_CPU_C::BxError },
/* 1 */ { BxRMGroup, NULL, opcodesGroupRmMONITOR },
/* 2 */ { 0, &BX_CPU_C::BxError },
/* 2 */ { BxRMGroup, NULL, opcodesGroupRmXGETSET },
/* 3 */ { 0, &BX_CPU_C::BxError },
/* 4 */ { 0, &BX_CPU_C::SMSW_Ew },
/* 5 */ { 0, &BX_CPU_C::BxError },
@ -3272,8 +3283,8 @@ static const BxOpcodeInfo_t BxOpcodeInfoG15M[8] = {
/* 1 */ { 0, &BX_CPU_C::FXRSTOR },
/* 2 */ { 0, &BX_CPU_C::LDMXCSR },
/* 3 */ { 0, &BX_CPU_C::STMXCSR },
/* 4 */ { 0, &BX_CPU_C::BxError },
/* 5 */ { 0, &BX_CPU_C::BxError },
/* 4 */ { 0, &BX_CPU_C::XSAVE },
/* 5 */ { 0, &BX_CPU_C::XRSTOR },
/* 6 */ { 0, &BX_CPU_C::BxError },
/* 7 */ { 0, &BX_CPU_C::CLFLUSH }
};

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.200 2008-02-11 20:52:10 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.201 2008-02-12 22:41:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -1320,8 +1320,13 @@ bx_bool BX_CPU_C::SetCR4(Bit32u val_32)
Bit32u oldCR4 = BX_CPU_THIS_PTR cr4.getRegister();
Bit32u allowMask = 0;
// CR4 bit definitions from AMD Hammer manual:
// [63-11] Reserved, Must be Zero
// CR4 bits definitions:
// [31-19] Reserved, Must be Zero
// [18] OSXSAVE: Operating System XSAVE Support R/W
// [17-15] Reserved, Must be Zero
// [14] SMXE: SMX Extensions R/W
// [13] VMXE: VMX Extensions R/W
// [12-11] Reserved, Must be Zero
// [10] OSXMMEXCPT: Operating System Unmasked Exception Support R/W
// [9] OSFXSR: Operating System FXSAVE/FXRSTOR Support R/W
// [8] PCE: Performance-Monitoring Counter Enable R/W
@ -1353,7 +1358,7 @@ bx_bool BX_CPU_C::SetCR4(Bit32u val_32)
#endif
#if BX_CPU_LEVEL >= 5
// NOTE: exception 18 never appears in Bochs
// NOTE: exception 18 (#MC) never appears in Bochs
allowMask |= (1<<6); /* MCE */
#endif
@ -1370,6 +1375,10 @@ bx_bool BX_CPU_C::SetCR4(Bit32u val_32)
allowMask |= (1<<10); /* OSXMMECPT */
#endif
#if BX_SUPPORT_XSAVE
allowMask |= (1<<18); /* OSXSAVE */
#endif
#if BX_SUPPORT_X86_64
// need to GP(0) if LMA=1 and PAE=1->0
if ((BX_CPU_THIS_PTR efer.lma)

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: dis_tables.h,v 1.32 2007-09-19 19:38:10 sshwarts Exp $
// $Id: dis_tables.h,v 1.33 2008-02-12 22:41:39 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
#ifndef _BX_DISASM_TABLES_
@ -71,10 +71,10 @@
#define Gd &disassembler::Gd
#define Gq &disassembler::Gq
#define Hbd &disassembler::Hbd
#define Hwd &disassembler::Hwd
#define Hd &disassembler::Hd
#define Hq &disassembler::Hq
#define Hbd &disassembler::Hbd
#define Hwd &disassembler::Hwd
#define Hd &disassembler::Hd
#define Hq &disassembler::Hq
#define I1 &disassembler::I1
#define Ib &disassembler::Ib
@ -119,10 +119,10 @@
#define Wps &disassembler::Wps
#define Wpd &disassembler::Wpd
#define Ob &disassembler::Ob
#define Ow &disassembler::Ow
#define Od &disassembler::Od
#define Oq &disassembler::Oq
#define Ob &disassembler::Ob
#define Ow &disassembler::Ow
#define Od &disassembler::Od
#define Oq &disassembler::Oq
#define Ma &disassembler::Ma
#define Mp &disassembler::Mp

View File

@ -1844,10 +1844,21 @@ static BxDisasmOpcodeTable_t BxDisasmGroupRmMONITOR[8] = {
/* 7 */ { 0, &Ia_Invalid }
};
static BxDisasmOpcodeTable_t BxDisasmGroupRmXSETGET[8] = {
/* 0 */ { 0, &Ia_xgetbv },
/* 1 */ { 0, &Ia_xsetbv },
/* 2 */ { 0, &Ia_Invalid },
/* 3 */ { 0, &Ia_Invalid },
/* 4 */ { 0, &Ia_Invalid },
/* 5 */ { 0, &Ia_Invalid },
/* 6 */ { 0, &Ia_Invalid },
/* 7 */ { 0, &Ia_Invalid }
};
static BxDisasmOpcodeTable_t BxDisasmGroupG7R[8] = {
/* 0 */ { GRPSSE(G7VMX) }, // VMX
/* 1 */ { GRPRM(MONITOR) },
/* 2 */ { 0, &Ia_Invalid },
/* 2 */ { GRPRM(XSETGET) },
/* 3 */ { 0, &Ia_Invalid },
/* 4 */ { 0, &Ia_smsw_Ew },
/* 5 */ { 0, &Ia_Invalid },
@ -1964,20 +1975,31 @@ static BxDisasmOpcodeTable_t BxDisasmGroupG14[8] = {
/* 7 */ { GRPSSE(G1407) }
};
static BxDisasmOpcodeTable_t BxDisasmGroupModCFLUSH[2] = {
/* R */ { 0, &Ia_sfence },
/* M */ { 0, &Ia_cflush }
};
static BxDisasmOpcodeTable_t BxDisasmGroupG15[8] = {
static BxDisasmOpcodeTable_t BxDisasmGroupG15M[8] = {
/* 0 */ { 0, &Ia_fxsave },
/* 1 */ { 0, &Ia_fxrstor },
/* 2 */ { 0, &Ia_ldmxcsr },
/* 3 */ { 0, &Ia_stmxcsr },
/* 4 */ { 0, &Ia_xsave },
/* 5 */ { 0, &Ia_xrstor },
/* 6 */ { 0, &Ia_Invalid },
/* 7 */ { 0, &Ia_cflush }
};
static BxDisasmOpcodeTable_t BxDisasmGroupG15R[8] = {
/* 0 */ { 0, &Ia_Invalid },
/* 1 */ { 0, &Ia_Invalid },
/* 2 */ { 0, &Ia_Invalid },
/* 3 */ { 0, &Ia_Invalid },
/* 4 */ { 0, &Ia_Invalid },
/* 5 */ { 0, &Ia_lfence },
/* 6 */ { 0, &Ia_mfence },
/* 7 */ { GRPMOD(CFLUSH) } /* SFENCE/CFLUSH */
/* 6 */ { 0, &Ia_sfence },
};
static BxDisasmOpcodeTable_t BxDisasmGroupModG15[2] = {
/* R */ { GRPN(G15R) },
/* M */ { GRPN(G15M) }
};
static BxDisasmOpcodeTable_t BxDisasmGroupG16[8] =
@ -3579,7 +3601,7 @@ static BxDisasmOpcodeTable_t BxDisasmOpcodes16[256*2] = {
/* 0F AB */ { 0, &Ia_btsw_Ew_Gw },
/* 0F AC */ { 0, &Ia_shrdw_Ew_Gw_Ib },
/* 0F AD */ { 0, &Ia_shrdw_Ew_Gw_CL },
/* 0F AE */ { GRPN(G15) },
/* 0F AE */ { GRPMOD(G15) },
/* 0F AF */ { 0, &Ia_imulw_Gw_Ew },
/* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
/* 0F B1 */ { 0, &Ia_cmpxchgw_Ew_Gw },
@ -4100,7 +4122,7 @@ static BxDisasmOpcodeTable_t BxDisasmOpcodes32[256*2] = {
/* 0F AB */ { 0, &Ia_btsl_Ed_Gd },
/* 0F AC */ { 0, &Ia_shrdl_Ed_Gd_Ib },
/* 0F AD */ { 0, &Ia_shrdl_Ed_Gd_CL },
/* 0F AE */ { GRPN(G15) },
/* 0F AE */ { GRPMOD(G15) },
/* 0F AF */ { 0, &Ia_imull_Gd_Ed },
/* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
/* 0F B1 */ { 0, &Ia_cmpxchgl_Ed_Gd },
@ -4621,7 +4643,7 @@ static BxDisasmOpcodeTable_t BxDisasmOpcodes64w[256*2] = {
/* 0F AB */ { 0, &Ia_btsw_Ew_Gw },
/* 0F AC */ { 0, &Ia_shrdw_Ew_Gw_Ib },
/* 0F AD */ { 0, &Ia_shrdw_Ew_Gw_CL },
/* 0F AE */ { GRPN(G15) },
/* 0F AE */ { GRPMOD(G15) },
/* 0F AF */ { 0, &Ia_imulw_Gw_Ew },
/* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
/* 0F B1 */ { 0, &Ia_cmpxchgw_Ew_Gw },
@ -5139,7 +5161,7 @@ static BxDisasmOpcodeTable_t BxDisasmOpcodes64d[256*2] = {
/* 0F AB */ { 0, &Ia_btsl_Ed_Gd },
/* 0F AC */ { 0, &Ia_shrdl_Ed_Gd_Ib },
/* 0F AD */ { 0, &Ia_shrdl_Ed_Gd_CL },
/* 0F AE */ { GRPN(G15) },
/* 0F AE */ { GRPMOD(G15) },
/* 0F AF */ { 0, &Ia_imull_Gd_Ed },
/* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
/* 0F B1 */ { 0, &Ia_cmpxchgl_Ed_Gd },
@ -5657,7 +5679,7 @@ static BxDisasmOpcodeTable_t BxDisasmOpcodes64q[256*2] = {
/* 0F AB */ { 0, &Ia_btsq_Eq_Gq },
/* 0F AC */ { 0, &Ia_shrdq_Eq_Gq_Ib },
/* 0F AD */ { 0, &Ia_shrdq_Eq_Gq_CL },
/* 0F AE */ { GRPN(G15) },
/* 0F AE */ { GRPMOD(G15) },
/* 0F AF */ { 0, &Ia_imulq_Gq_Eq },
/* 0F B0 */ { 0, &Ia_cmpxchgb_Eb_Gb },
/* 0F B1 */ { 0, &Ia_cmpxchgq_Eq_Gq },

View File

@ -34,11 +34,14 @@
#define IA_SSE4_1 0x00004000 /* SSE4_1 instruction */
#define IA_SSE4_2 0x00008000 /* SSE4_2 instruction */
#define IA_SSE4A 0x00010000 /* SSE4A instruction */
#define IA_SSE5 0x00020000 /* SSE5 instruction */
#define IA_SSE5A 0x00020000 /* SSE5A instruction */
#define IA_X86_64 0x00040000 /* x86-64 instruction */
#define IA_SYSCALL_SYSRET 0x00080000 /* SYSCALL/SYSRET instruction */
#define IA_SYSENTER_SYSEXIT 0x00100000 /* SYSENTER/SYSEXIT instruction */
#define IA_VMX 0x00200000 /* VMX instruction */
#define IA_SMX 0x00400000 /* SMX instruction */
#define IA_SVM 0x00800000 /* SVM instruction */
#define IA_XSAVE 0x01000000 /* XSAVE/XRSTOR extensions instruction */
#define IA_UNDOCUMENTED 0x80000000 /* instruction undocumented */
/* general purpose bit register */

File diff suppressed because it is too large Load Diff