Make XSAVE as runtime option

This commit is contained in:
Stanislav Shwartsman 2010-02-26 22:53:43 +00:00
parent 5df864b1f1
commit 5b6a14656d
19 changed files with 137 additions and 152 deletions

View File

@ -159,6 +159,10 @@ cpu: count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="ms
# Select MOVBE Intel(R) Atom instruction support.
# This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
#
# XSAVE:
# Select XSAVE extensions support.
# This option exists only if Bochs compiled with BX_CPU_LEVEL >= 6.
#
# VENDOR_STRING:
# Set the CPUID vendor string returned by CPUID(0x0). This should be a
# twelve-character ASCII string.
@ -171,7 +175,7 @@ cpu: count=1, ips=50000000, reset_on_triple_fault=1, ignore_bad_msrs=1, msrs="ms
# Determine whether to limit maximum CPUID function to 3. This mode is
# required to workaround WinNT installation and boot issues.
#=======================================================================
cpuid: sep=1, sse=sse4_2, aes=1, movbe=1, cpuid_limit_winnt=0
cpuid: sep=1, sse=sse4_2, aes=1, movbe=1, xsave=1, cpuid_limit_winnt=0
#=======================================================================
# MEMORY

View File

@ -19,7 +19,6 @@
--enable-alignment-check \
--enable-3dnow \
--enable-monitor-mwait \
--enable-xsave \
--enable-vmx \
--enable-x86-debugger \
--enable-a20-pin \

View File

@ -17,8 +17,8 @@ Detailed change log :
- Introduced new configure option --enable-xapic. The option is used to
differentiate between legacy APIC and Pentium4 XAPIC implementations.
The XAPIC will be automatically enabled by configure for x86-64 only.
Make sure that you add XAPIC option explicitly for Pentium4 like
The XAPIC will be automatically enabled by configure for x86-64 only,
make sure that you add XAPIC option explicitly for Pentium4 like
configurations. The option will be extended in future to configure
X2APIC emulation as well.
@ -29,10 +29,10 @@ Detailed change log :
configure option is deprecated and should not be used anymore.
- Enable changing part of CPU functionality at runtime through .bochsrc.
Now you could enable/disable any of SSEx/AES/MOVBE/SYSENTER_SYSEXIT
Now you could enable/disable any of SSEx/AES/MOVBE/SYSENTER_SYSEXIT/XSAVE
instruction sets using new CPUID option in .bochsrc.
Configure options:
--enable-sse, --enable-aes, --enable-movbe, --enable-sep
--enable-sse, --enable-aes, --enable-movbe, --enable-sep, --enable-xsave
are deprecated and should not be used anymore.
- CPU

View File

@ -1,4 +1,4 @@
$Id: PARAM_TREE.txt,v 1.24 2010-02-25 22:34:56 sshwarts Exp $
$Id: PARAM_TREE.txt,v 1.25 2010-02-26 22:53:43 sshwarts Exp $
Starting from Bochs 2.3 the parameters are organized in a tree structure
instead of a huge flat list. The parameter tree was required for implementing
@ -29,9 +29,11 @@ cpuid
cpuid_limit_winnt
vendor_string
brand_string
sep
sse
aes
movbe
xsave
memory
standard

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.195 2010-02-26 14:18:18 sshwarts Exp $
// $Id: config.cc,v 1.196 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002-2009 The Bochs Project
@ -358,7 +358,7 @@ void bx_init_options()
cpu_param->set_options(menu->SHOW_PARENT);
// cpuid subtree
bx_list_c *cpuid_param = new bx_list_c(root_param, "cpuid", "CPUID Options", 7);
bx_list_c *cpuid_param = new bx_list_c(root_param, "cpuid", "CPUID Options", 8);
new bx_param_bool_c(cpuid_param,
"cpuid_limit_winnt", "Limit max CPUID function to 3",
@ -407,6 +407,10 @@ void bx_init_options()
"sep", "Support for SYSENTER/SYSEXIT instructions",
"Support for SYSENTER/SYSEXIT instructions",
(BX_CPU_LEVEL >= 6 && BX_SUPPORT_MMX) || BX_SUPPORT_X86_64);
new bx_param_bool_c(cpuid_param,
"xsave", "Support for XSAVE extensions",
"Support for XSAVE extensions",
0);
#endif
cpuid_param->set_options(menu->SHOW_PARENT);
@ -851,6 +855,9 @@ void bx_init_options()
// loader hack
bx_list_c *load32bitos = new bx_list_c(boot_params, "load32bitos", "32-bit OS Loader Hack");
static const char *loader_os_names[] = { "none", "linux", "nullkernel", NULL };
bx_param_enum_c *whichOS = new bx_param_enum_c(load32bitos,
"which",
"Which operating system?",
@ -2615,6 +2622,12 @@ static int parse_line_formatted(const char *context, int num_params, char *param
} else {
PARSE_ERR(("%s: cpuid directive malformed.", context));
}
} else if (!strncmp(params[i], "xsave=", 6)) {
if (params[i][6] == '0' || params[i][6] == '1') {
SIM->get_param_bool(BXPN_CPUID_XSAVE)->set(params[i][6] - '0');
} else {
PARSE_ERR(("%s: cpuid directive malformed.", context));
}
#endif
} else {
PARSE_ERR(("%s: cpuid directive malformed.", context));
@ -3777,10 +3790,11 @@ int bx_write_configuration(const char *rc, int overwrite)
fprintf(fp, "\n");
fprintf(fp, "cpuid: cpuid_limit_winnt=%d", SIM->get_param_bool(BXPN_CPUID_LIMIT_WINNT)->get());
#if BX_CPU_LEVEL >= 6
fprintf(fp, ", sse=%s, sep=%d, aes=%d, movbe=%d",
fprintf(fp, ", sse=%s, sep=%d, aes=%d, xsave=%d, movbe=%d",
SIM->get_param_enum(BXPN_CPUID_SSE)->get_selected(),
SIM->get_param_bool(BXPN_CPUID_SEP)->get(),
SIM->get_param_bool(BXPN_CPUID_AES)->get(),
SIM->get_param_bool(BXPN_CPUID_XSAVE)->get(),
SIM->get_param_bool(BXPN_CPUID_MOVBE)->get());
#endif
fprintf(fp, "\n");

View File

@ -687,7 +687,6 @@ typedef
#define BX_SUPPORT_3DNOW 0
#define BX_SUPPORT_MISALIGNED_SSE 0
#define BX_SUPPORT_MONITOR_MWAIT 0
#define BX_SUPPORT_XSAVE 0
#define BX_SUPPORT_VMX 0
#define BX_SUPPORT_1G_PAGES 0
#define BX_SUPPORT_XAPIC 0

57
bochs/configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in,v 1.425 2010/02/25 22:04:30 sshwarts Exp .
# From configure.in Id: configure.in,v 1.426 2010/02/26 11:44:50 sshwarts Exp .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65.
#
@ -974,7 +974,6 @@ enable_fpu
enable_vmx
enable_mmx
enable_3dnow
enable_xsave
enable_alignment_check
enable_misaligned_sse
enable_xapic
@ -1005,6 +1004,7 @@ enable_sse_extension
enable_popcnt
enable_movbe
enable_aes
enable_xsave
enable_sep
enable_apic
enable_ignore_bad_msr
@ -1693,7 +1693,6 @@ Optional Features:
--enable-vmx virtualization extensions
--enable-mmx MMX support
--enable-3dnow 3DNow! support (incomplete)
--enable-xsave support for XSAVE/XRSTOR extensions
--enable-alignment-check alignment check (#AC) support
--enable-misaligned-sse misaligned SSE support
--enable-xapic support for XAPIC extensions
@ -1711,6 +1710,7 @@ Optional Features:
--enable-popcnt support for POPCNT intruction (deprecated)
--enable-movbe support for MOVBE intruction (deprecated)
--enable-aes support for AES intruction set (deprecated)
--enable-xsave support for XSAVE extensions (deprecated)
--enable-sep support for SYSENTER/SYSEXIT intructions (deprecated)
--enable-apic enable APIC support (deprecated)
--enable-ignore-bad-msr ignore bad MSR references (deprecated)
@ -22998,6 +22998,7 @@ fi
support_vmx=0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for VMX support" >&5
$as_echo_n "checking for VMX support... " >&6; }
# Check whether --enable-vmx was given.
@ -23007,6 +23008,7 @@ if test "${enable_vmx+set}" = set; then :
$as_echo "yes" >&6; }
$as_echo "#define BX_SUPPORT_VMX 1" >>confdefs.h
support_vmx=1
elif test "$enableval" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@ -23025,6 +23027,10 @@ $as_echo "no" >&6; }
fi
if test "$support_vmx" -lt 0 -a "$bx_cpu_level" -lt 6; then
as_fn_error "for VMX support the CPU level must be set to 6" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MMX support" >&5
$as_echo_n "checking for MMX support... " >&6; }
# Check whether --enable-mmx was given.
@ -23083,35 +23089,6 @@ $as_echo "no" >&6; }
fi
use_xsave=0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSAVE/XRSTOR support" >&5
$as_echo_n "checking for XSAVE/XRSTOR support... " >&6; }
# Check whether --enable-xsave was given.
if test "${enable_xsave+set}" = set; then :
enableval=$enable_xsave; if test "$enableval" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define BX_SUPPORT_XSAVE 1" >>confdefs.h
use_xsave=1
elif test "$enableval" = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "#define BX_SUPPORT_XSAVE 0" >>confdefs.h
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "#define BX_SUPPORT_XSAVE 0" >>confdefs.h
fi
@ -25125,6 +25102,22 @@ $as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XSAVE support (deprecated)" >&5
$as_echo_n "checking for XSAVE support (deprecated)... " >&6; }
# Check whether --enable-xsave was given.
if test "${enable_xsave+set}" = set; then :
enableval=$enable_xsave; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enableval" >&5
$as_echo "$enableval" >&6; }
as_fn_error "DEPRECATED - moved to .bochsrc options" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEP support (deprecated)" >&5
$as_echo_n "checking for SEP support (deprecated)... " >&6; }
# Check whether --enable-sep 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.426 2010-02-26 11:44:50 sshwarts Exp $]])
AC_REVISION([[$Id: configure.in,v 1.427 2010-02-26 22:53:43 sshwarts Exp $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
@ -1391,12 +1391,14 @@ AC_ARG_ENABLE(fpu,
)
AC_SUBST(FPU_VAR)
support_vmx=0
AC_MSG_CHECKING(for VMX support)
AC_ARG_ENABLE(vmx,
[ --enable-vmx virtualization extensions],
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_VMX, 1)
support_vmx=1
elif test "$enableval" = no; then
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_VMX, 0)
@ -1408,6 +1410,10 @@ AC_ARG_ENABLE(vmx,
]
)
if test "$support_vmx" -lt 0 -a "$bx_cpu_level" -lt 6; then
AC_MSG_ERROR([for VMX support the CPU level must be set to 6])
fi
AC_MSG_CHECKING(for MMX support)
AC_ARG_ENABLE(mmx,
[ --enable-mmx MMX support],
@ -1447,25 +1453,6 @@ AC_ARG_ENABLE(3dnow,
]
)
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)
]
)
AC_MSG_CHECKING(for alignment check support)
AC_ARG_ENABLE(alignment-check,
[ --enable-alignment-check alignment check (#AC) support],
@ -2697,6 +2684,16 @@ AC_ARG_ENABLE(aes,
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for XSAVE support (deprecated))
AC_ARG_ENABLE(xsave,
[ --enable-xsave support for XSAVE extensions (deprecated)],
[AC_MSG_RESULT($enableval)
AC_MSG_ERROR([DEPRECATED - moved to .bochsrc options])
],
[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for SEP support (deprecated))
AC_ARG_ENABLE(sep,
[ --enable-sep support for SYSENTER/SYSEXIT intructions (deprecated)],

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpu.h,v 1.641 2010-02-26 11:44:50 sshwarts Exp $
// $Id: cpu.h,v 1.642 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -755,9 +755,6 @@ typedef struct {
#if BX_SUPPORT_FPU
#include "cpu/i387.h"
#endif
#if BX_CPU_LEVEL >= 6
#include "cpu/xmm.h"
#endif
@ -876,7 +873,7 @@ public: // for now...
bx_efer_t efer;
#endif
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
xcr0_t xcr0;
#endif
@ -2875,18 +2872,18 @@ public: // for now...
#if BX_SUPPORT_MISALIGNED_SSE
#define readVirtualDQwordAligned(s, off, data) \
if (! MXCSR.get_misaligned_exception_mask()) { \
read_virtual_dqword_aligned(s, off, data); \
} \
else { \
read_virtual_dqword(s, off, data); \
#define readVirtualDQwordAligned(s, off, data) \
if (! BX_CPU_THIS_PTR mxcsr.get_misaligned_exception_mask()) { \
read_virtual_dqword_aligned(s, off, data); \
} \
else { \
read_virtual_dqword(s, off, data); \
}
#else // BX_SUPPORT_MISALIGNED_SSE = 0
#define readVirtualDQwordAligned(s, off, data) { \
read_virtual_dqword_aligned(s, off, data); \
#define readVirtualDQwordAligned(s, off, data) { \
read_virtual_dqword_aligned(s, off, data); \
}
#endif
@ -3341,7 +3338,7 @@ public: // for now...
BX_SMF void print_state_SSE(void);
#endif
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
BX_SMF void prepareXSAVE(void);
#endif
@ -3442,7 +3439,7 @@ BX_CPP_INLINE void BX_CPU_C::prepareSSE(void)
}
#endif
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
BX_CPP_INLINE void BX_CPU_C::prepareXSAVE(void)
{
if(! BX_CPU_THIS_PTR cr4.get_OSXSAVE())

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cpuid.cc,v 1.93 2010-02-26 14:18:18 sshwarts Exp $
// $Id: cpuid.cc,v 1.94 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2007-2009 Stanislav Shwartsman
@ -241,7 +241,7 @@ Bit32u BX_CPU_C::get_std_cpuid_features(void)
#if BX_CPU_LEVEL >= 5
if (BX_CPU_THIS_PTR cpuid_features_bitmask & BX_CPU_PENTIUM) {
// Pentium only features
features |= (1<<1);
features |= (1<<1); // support VME
features |= (1<<3); // support PSE
features |= (1<<4); // support Time Stamp Counter
features |= (1<<5); // support RDMSR/WRMSR
@ -299,9 +299,7 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::CPUID(bxInstruction_c *i)
{
#if BX_CPU_LEVEL >= 4
Bit32u function = EAX;
#if BX_SUPPORT_XSAVE
Bit32u subfunction = ECX;
#endif
#if BX_SUPPORT_VMX
if (BX_CPU_THIS_PTR in_vmx_guest) {
@ -324,14 +322,12 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::CPUID(bxInstruction_c *i)
RDX &= ~(1<<9); // APIC on chip
}
#endif
#if BX_SUPPORT_XSAVE
if (function == 0xD && subfunction > 0) {
RAX = 0;
RBX = 0;
RCX = 0;
RDX = 0;
}
#endif
return;
}
}
@ -408,7 +404,7 @@ void BX_CPU_C::set_cpuid_defaults(void)
if (! cpuid_limit_winnt) {
if (BX_SUPPORT_MONITOR_MWAIT)
cpuid->eax = 0x5;
if (BX_SUPPORT_XSAVE)
if (BX_CPU_SUPPORT_FEATURE(BX_CPU_XSAVE))
cpuid->eax = 0xD;
}
#endif
@ -572,23 +568,24 @@ void BX_CPU_C::set_cpuid_defaults(void)
cpuid->edx = 0;
#endif
#if BX_SUPPORT_XSAVE
// ------------------------------------------------------
// CPUID function 0x0000000D
cpuid = &(BX_CPU_THIS_PTR cpuid_std_function[0xD]);
if (BX_CPU_SUPPORT_FEATURE(BX_CPU_XSAVE))
{
cpuid = &(BX_CPU_THIS_PTR cpuid_std_function[0xD]);
// EAX - XCR0 lower 32 bits
// EBX - Maximum size (in bytes) required by enabled features
// ECX - Maximum size (in bytes) required by CPU supported features
// EDX - XCR0 upper 32 bits
cpuid->eax = BX_CPU_THIS_PTR xcr0.get32();
cpuid->ebx = 512+64;
cpuid->ecx = 512+64;
cpuid->edx = 0;
#endif
// EAX - XCR0 lower 32 bits
// EBX - Maximum size (in bytes) required by enabled features
// ECX - Maximum size (in bytes) required by CPU supported features
// EDX - XCR0 upper 32 bits
cpuid->eax = BX_CPU_THIS_PTR xcr0.get32();
cpuid->ebx = 512+64;
cpuid->ecx = 512+64;
cpuid->edx = 0;
}
// do not report Pentium 4 extended functions if not needed
if ((BX_CPU_THIS_PTR cpuid_features_bitmask & BX_CPU_SSE2) == 0)
if (! BX_CPU_SUPPORT_FEATURE(BX_CPU_SSE2))
return;
// ------------------------------------------------------
@ -769,6 +766,7 @@ void BX_CPU_C::init_cpu_features_bitmask(void)
bx_bool sep_enabled = SIM->get_param_bool(BXPN_CPUID_SEP)->get();
bx_bool aes_enabled = SIM->get_param_bool(BXPN_CPUID_AES)->get();
bx_bool movbe_enabled = SIM->get_param_bool(BXPN_CPUID_MOVBE)->get();
bx_bool xsave_enabled = SIM->get_param_bool(BXPN_CPUID_XSAVE)->get();
unsigned sse_enabled = SIM->get_param_enum(BXPN_CPUID_SSE)->get();
// sanity checks
@ -802,7 +800,7 @@ void BX_CPU_C::init_cpu_features_bitmask(void)
}
}
else {
if (BX_SUPPORT_XSAVE) {
if (xsave_enabled) {
BX_PANIC(("PANIC: XSAVE emulation requires SSE support !"));
return;
}
@ -870,24 +868,20 @@ void BX_CPU_C::init_cpu_features_bitmask(void)
if (sep_enabled)
features_bitmask |= BX_CPU_SYSENTER_SYSEXIT;
if (xsave_enabled)
features_bitmask |= BX_CPU_XSAVE;
if (aes_enabled)
features_bitmask |= BX_CPU_AES | BX_CPU_PCLMULQDQ;
if (movbe_enabled)
features_bitmask |= BX_CPU_MOVBE;
#endif
#if BX_SUPPORT_VMX
features_bitmask |= BX_CPU_VMX;
#endif
#if BX_SUPPORT_XSAVE
features_bitmask |= BX_CPU_XSAVE;
#endif
#if BX_CPU_LEVEL >= 6
if (aes_enabled) {
features_bitmask |= BX_CPU_AES;
features_bitmask |= BX_CPU_PCLMULQDQ;
}
if (movbe_enabled)
features_bitmask |= BX_CPU_MOVBE;
#endif
#if BX_SUPPORT_X86_64
features_bitmask |= BX_CPU_X86_64;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: crregs.h,v 1.21 2010-02-25 22:04:30 sshwarts Exp $
// $Id: crregs.h,v 1.22 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2007-2009 Stanislav Shwartsman
@ -94,7 +94,7 @@ struct bx_cr4_t {
#if BX_SUPPORT_VMX
IMPLEMENT_CRREG_ACCESSORS(VMXE, 13);
#endif
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
IMPLEMENT_CRREG_ACCESSORS(OSXSAVE, 18);
#endif
@ -125,7 +125,7 @@ struct bx_efer_t {
#endif
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
struct xcr0_t {
Bit32u val32; // 32bit value of register

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: init.cc,v 1.227 2010-02-26 14:18:18 sshwarts Exp $
// $Id: init.cc,v 1.228 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -362,8 +362,10 @@ void BX_CPU_C::register_state(void)
#if BX_CPU_LEVEL >= 4
BXRS_HEX_PARAM_FIELD(cpu, CR4, cr4.val32);
#endif
#if BX_SUPPORT_XSAVE
BXRS_HEX_PARAM_FIELD(cpu, XCR0, xcr0.val32);
#if BX_CPU_LEVEL >= 6
if (BX_CPU_SUPPORT_FEATURE(BX_CPU_XSAVE)) {
BXRS_HEX_PARAM_FIELD(cpu, XCR0, xcr0.val32);
}
#endif
for(n=0; n<6; n++) {
@ -915,7 +917,7 @@ void BX_CPU_C::reset(unsigned source)
BX_CPU_THIS_PTR cr4.set32(0);
#endif
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
BX_CPU_THIS_PTR xcr0.set32(0x1);
#endif

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.313 2010-02-26 11:44:50 sshwarts Exp $
// $Id: proc_ctrl.cc,v 1.314 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -1460,8 +1460,10 @@ bx_address get_cr4_allow_mask(void)
allowMask |= (1<<14); /* SMX Enable */
#endif
#if BX_SUPPORT_XSAVE
allowMask |= (1<<18); /* OSXSAVE */
#if BX_CPU_LEVEL >= 6
/* OSXSAVE */
if (BX_CPU_SUPPORT_FEATURE(BX_CPU_XSAVE))
allowMask |= (1<<18);
#endif
return allowMask;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: xsave.cc,v 1.24 2009-12-04 21:27:17 sshwarts Exp $
// $Id: xsave.cc,v 1.25 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2008-2009 Stanislav Shwartsman
@ -35,7 +35,7 @@
/* 0F AE /4 */
void BX_CPP_AttrRegparmN(1) BX_CPU_C::XSAVE(bxInstruction_c *i)
{
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
unsigned index;
BxPackedXmmRegister xmm;
@ -150,16 +150,13 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::XSAVE(bxInstruction_c *i)
// always update header to 'dirty' state
write_virtual_qword(i->seg(), eaddr + 512, header1);
#else
BX_INFO(("XSAVE: required XSAVE support, use --enable-xsave option"));
exception(BX_UD_EXCEPTION, 0, 0);
#endif
}
/* 0F AE /5 */
void BX_CPP_AttrRegparmN(1) BX_CPU_C::XRSTOR(bxInstruction_c *i)
{
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
unsigned index;
BxPackedXmmRegister xmm;
@ -301,16 +298,13 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::XRSTOR(bxInstruction_c *i)
}
}
}
#else
BX_INFO(("XRSTOR: required XSAVE support, use --enable-xsave option"));
exception(BX_UD_EXCEPTION, 0, 0);
#endif
}
/* 0F 01 D0 */
void BX_CPP_AttrRegparmN(1) BX_CPU_C::XGETBV(bxInstruction_c *i)
{
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
if(! BX_CPU_THIS_PTR cr4.get_OSXSAVE()) {
BX_ERROR(("XGETBV: OSXSAVE feature is not enabled in CR4!"));
exception(BX_UD_EXCEPTION, 0, 0);
@ -325,16 +319,13 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::XGETBV(bxInstruction_c *i)
RDX = 0;
RAX = BX_CPU_THIS_PTR xcr0.get32();
#else
BX_INFO(("XGETBV: required XSAVE support, use --enable-xsave option"));
exception(BX_UD_EXCEPTION, 0, 0);
#endif
}
/* 0F 01 D1 */
void BX_CPP_AttrRegparmN(1) BX_CPU_C::XSETBV(bxInstruction_c *i)
{
#if BX_SUPPORT_XSAVE
#if BX_CPU_LEVEL >= 6
if(! BX_CPU_THIS_PTR cr4.get_OSXSAVE()) {
BX_ERROR(("XSETBV: OSXSAVE feature is not enabled in CR4!"));
exception(BX_UD_EXCEPTION, 0, 0);
@ -358,8 +349,5 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::XSETBV(bxInstruction_c *i)
}
BX_CPU_THIS_PTR xcr0.set32(EAX);
#else
BX_INFO(("XSETBV: required XSAVE support, use --enable-xsave option"));
exception(BX_UD_EXCEPTION, 0, 0);
#endif
}

View File

@ -1,7 +1,7 @@
<!--
================================================================
doc/docbook/user/user.dbk
$Id: user.dbk,v 1.274 2010-02-26 11:44:50 sshwarts Exp $
$Id: user.dbk,v 1.275 2010-02-26 22:53:43 sshwarts Exp $
This is the top level file for the Bochs Users Manual.
================================================================
@ -2091,11 +2091,6 @@ turn it off.
Add support for MMX instructions, written by Stanislav Shwartsman.
</entry>
</row>
<row>
<entry>--enable-xsave</entry>
<entry>no</entry>
<entry>XSAVE support</entry>
</row>
<row>
<entry>--enable-vmx</entry>
<entry>no</entry>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.212 2010-02-26 14:18:18 sshwarts Exp $
// $Id: siminterface.cc,v 1.213 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -466,9 +466,7 @@ int bx_real_sim_c::get_cdrom_options(int level, bx_list_c **out, int *where)
const char *floppy_devtype_names[] = { "none", "5.25\" 360K", "5.25\" 1.2M", "3.5\" 720K", "3.5\" 1.44M", "3.5\" 2.88M", NULL };
const char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K", "360K", "160K", "180K", "320K", "auto", NULL };
int floppy_type_n_sectors[] = { -1, 80*2*15, 80*2*18, 80*2*36, 80*2*9, 40*2*9, 40*1*8, 40*1*9, 40*2*8, -1 };
const char *bochs_bootdisk_names[] = { "none", "floppy", "disk","cdrom", "network", NULL };
const char *loader_os_names[] = { "none", "linux", "nullkernel", NULL };
const char *keyboard_type_names[] = { "xt", "at", "mf", NULL };
const char *atadevice_mode_names[] = {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.249 2010-02-26 14:18:18 sshwarts Exp $
// $Id: siminterface.h,v 1.250 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -975,7 +975,6 @@ BOCHSAPI extern const char *floppy_devtype_names[];
BOCHSAPI extern const char *floppy_type_names[];
BOCHSAPI extern int floppy_type_n_sectors[];
BOCHSAPI extern const char *bochs_bootdisk_names[];
BOCHSAPI extern const char *loader_os_names[];
BOCHSAPI extern const char *keyboard_type_names[];
BOCHSAPI extern const char *atadevice_mode_names[];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.413 2010-02-26 14:18:18 sshwarts Exp $
// $Id: main.cc,v 1.414 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2009 The Bochs Project
@ -987,6 +987,7 @@ void bx_init_hardware()
bx_bool aes_enabled = SIM->get_param_bool(BXPN_CPUID_AES)->get();
bx_bool movbe_enabled = SIM->get_param_bool(BXPN_CPUID_MOVBE)->get();
bx_bool sep_enabled = SIM->get_param_bool(BXPN_CPUID_SEP)->get();
bx_bool xsave_enabled = SIM->get_param_bool(BXPN_CPUID_XSAVE)->get();
// Output to the log file the cpu and device settings
// This will by handy for bug reports
@ -1019,7 +1020,7 @@ void bx_init_hardware()
BX_INFO((" x86-64 support: %s",BX_SUPPORT_X86_64?"yes":"no"));
BX_INFO((" SEP support: %s",sep_enabled?"yes":"no"));
BX_INFO((" MWAIT support: %s",BX_SUPPORT_MONITOR_MWAIT?"yes":"no"));
BX_INFO((" XSAVE support: %s",BX_SUPPORT_XSAVE?"yes":"no"));
BX_INFO((" XSAVE support: %s",xsave_enabled?"yes":"no"));
BX_INFO((" AES support: %s",aes_enabled?"yes":"no"));
BX_INFO((" MOVBE support: %s",movbe_enabled?"yes":"no"));
BX_INFO((" VMX support: %s",BX_SUPPORT_VMX?"yes":"no"));

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: param_names.h,v 1.1 2010-02-26 14:18:18 sshwarts Exp $
// $Id: param_names.h,v 1.2 2010-02-26 22:53:43 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2009 The Bochs Project
@ -47,6 +47,7 @@
#define BXPN_CPUID_AES "cpuid.aes"
#define BXPN_CPUID_MOVBE "cpuid.movbe"
#define BXPN_CPUID_SEP "cpuid.sep"
#define BXPN_CPUID_XSAVE "cpuid.xsave"
#define BXPN_MEM_SIZE "memory.standard.ram.size"
#define BXPN_HOST_MEM_SIZE "memory.standard.ram.host_size"
#define BXPN_ROM_PATH "memory.standard.rom.path"