support for both dyn_x86 and dyn_rec cores

This commit is contained in:
Wengier
2020-10-12 21:15:54 -04:00
parent ef3b07ba26
commit 53553a2edb
5 changed files with 78 additions and 40 deletions

View File

@@ -1,9 +1,13 @@
0.83.7
- Implemented the dynamic X86 core for both 32-bit
and 64-bit systems by re-porting the code from SVN.
Setting "core=dynamic" will now use the dynamic x86
core by default on x86 and x86-64 systems instead
of the dynrec core. (Wengier and joncampbell123)
Dynamic core now supports either the dynamic_x86
or the dynamic_rec core. The dynamic_x86 core will
be used by default for x86 and x86 platforms and if
"core=dynamic" is set. You can also explict specify
"core=dynamic_x86" or "core=dynamic_rec" for either
the dynamic_x86 core or the dynamic_rec core. Also
thank joncampbell123 for the 64-bit fix. (Wengier)
- Save state feature now allows users to optionally
enter remarks when saving a state. A toggle menu
item "No remark when saving state" (in "Capture")

View File

@@ -787,32 +787,24 @@ AC_ARG_ENABLE(dynamic-core,AC_HELP_STRING([--disable-dynamic-core],[Disable all
dnl FEATURE: Whether to enable x86 dynamic core
AH_TEMPLATE(C_DYNAMIC_X86,[Define to 1 to use x86 dynamic cpu core])
AC_ARG_ENABLE(dynamic-x86,AC_HELP_STRING([--enable-dynamic-x86],[Enable x86 dynamic cpu core]),enable_dynamic_x86=$enableval,enable_dynamic_x86=yes)
AC_ARG_ENABLE(dynamic-x86,AC_HELP_STRING([--disable-dynamic-x86],[Disable x86 dynamic cpu core]),,enable_dynamic_x86=yes)
AC_MSG_CHECKING(whether x86 dynamic cpu core will be enabled)
if test x$enable_dynamic_x86 = xno -o x$enable_dynamic_core = xno; then
if test x$enable_dynamic_x86 = xno -o x$enable_dynamic_core = xno -o x$c_targetcpu = xarm; then
AC_MSG_RESULT(no)
else
if test x$c_targetcpu = xx86 -o x$c_targetcpu = xx86_64; then
AC_DEFINE(C_DYNAMIC_X86,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_DEFINE(C_DYNAMIC_X86,1)
AC_MSG_RESULT(yes)
fi
AH_TEMPLATE(C_DYNREC,[Define to 1 to use recompiling cpu core. Can not be used together with the dynamic-x86 core])
dnl FEATURE: Whether to enable recompiling dynamic core
AH_TEMPLATE(C_DYNREC,[Define to 1 to use recompiling cpu core])
AC_ARG_ENABLE(dynrec,AC_HELP_STRING([--disable-dynrec],[Disable recompiling cpu core]),,enable_dynrec=yes)
AC_MSG_CHECKING(whether recompiling cpu core will be enabled)
if test x$enable_dynrec = xno -o x$enable_dynamic_core = xno; then
AC_MSG_RESULT(no)
else
dnl x86 only enable it if dynamic-x86 is disabled.
if test x$enable_dynamic_x86 = xno -o x$c_targetcpu = xarm ; then
AC_DEFINE(C_DYNREC,1)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_DEFINE(C_DYNREC,1)
AC_MSG_RESULT(yes)
fi
dnl FEATURE: Whether to emulate the floating point unit

View File

@@ -173,7 +173,8 @@ void CPU_Core_Dyn_X86_Cache_Close(void);
void CPU_Core_Dyn_X86_Cache_Reset(void);
void CPU_Core_Dyn_X86_SetFPUMode(bool dh_fpu);
void CPU_Core_Dyn_X86_Cache_Reset(void);
#elif (C_DYNREC)
#endif
#if (C_DYNREC)
void CPU_Core_Dynrec_Init(void);
void CPU_Core_Dynrec_Cache_Init(bool enable_cache);
void CPU_Core_Dynrec_Cache_Close(void);
@@ -262,6 +263,32 @@ void menu_update_cputype(void) {
refresh_item(mainMenu);
}
int GetDynamicType() {
const Section_prop * section=static_cast<Section_prop *>(control->GetSection("cpu"));
std::string core(section->Get_string("core"));
#if (C_DYNAMIC_X86) && (C_TARGETCPU == X86_64 || C_TARGETCPU == X86)
if (core == "dynamic_x86" || core == "dynamic_nodhfpu")
return 1;
#endif
#if (C_DYNREC)
if (core == "dynamic_rec")
return 2;
#endif
#if C_TARGETCPU == X86_64 || C_TARGETCPU == X86
# if (C_DYNAMIC_X86)
return 1;
# elif (C_DYNREC)
return 2;
# else
return 0;
# endif
#elif (C_DYNREC)
return 2;
#else
return 0;
#endif
}
void menu_update_core(void) {
const Section_prop * cpu_section = static_cast<Section_prop *>(control->GetSection("cpu"));
const std::string cpu_sec_type = cpu_section->Get_string("cputype");
@@ -301,7 +328,9 @@ void menu_update_core(void) {
refresh_item(mainMenu);
#endif
#if (C_DYNAMIC_X86)
if (GetDynamicType()==1)
mainMenu.get_item("mapper_dynamic").
set_text("Dynamic core (dynamic_x86)").
check(cpudecoder == &CPU_Core_Dyn_X86_Run).
enable(allow_dynamic &&
(cpudecoder != &CPU_Core_Prefetch_Run) &&
@@ -312,7 +341,9 @@ void menu_update_core(void) {
refresh_item(mainMenu);
#endif
#if (C_DYNREC)
if (GetDynamicType()==2)
mainMenu.get_item("mapper_dynamic").
set_text("Dynamic core (dynamic_rec)").
check(cpudecoder == &CPU_Core_Dynrec_Run).
enable(allow_dynamic &&
(cpudecoder != &CPU_Core_Prefetch_Run) &&
@@ -2268,7 +2299,8 @@ bool CPU_IsDynamicCore(void) {
#if (C_DYNAMIC_X86)
if (cpudecoder == &CPU_Core_Dyn_X86_Run)
return true;
#elif (C_DYNREC)
#endif
#if (C_DYNREC)
if (cpudecoder == &CPU_Core_Dynrec_Run)
return true;
#endif
@@ -2310,13 +2342,14 @@ void CPU_SET_CRX(Bitu cr,Bitu value) {
GFX_SetTitle(-1,-1,-1,false);
}
#if (C_DYNAMIC_X86)
if (CPU_AutoDetermineMode&CPU_AUTODETERMINE_CORE) {
if (GetDynamicType()==1 && CPU_AutoDetermineMode&CPU_AUTODETERMINE_CORE) {
CPU_Core_Dyn_X86_Cache_Init(true);
cpudecoder=&CPU_Core_Dyn_X86_Run;
strcpy(core_mode, "dynamic");
}
#elif (C_DYNREC)
if (CPU_AutoDetermineMode&CPU_AUTODETERMINE_CORE) {
#endif
#if (C_DYNREC)
if (GetDynamicType()==2 && CPU_AutoDetermineMode&CPU_AUTODETERMINE_CORE) {
CPU_Core_Dynrec_Cache_Init(true);
cpudecoder=&CPU_Core_Dynrec_Run;
}
@@ -3175,7 +3208,8 @@ public:
#endif
#if (C_DYNAMIC_X86)
CPU_Core_Dyn_X86_Init();
#elif (C_DYNREC)
#endif
#if (C_DYNREC)
CPU_Core_Dynrec_Init();
#endif
MAPPER_AddHandler(CPU_CycleDecrease,MK_minus,MMODHOST,"cycledown","Dec Cycles",&item);
@@ -3192,7 +3226,7 @@ public:
item->set_text("Normal core");
#if (C_DYNAMIC_X86) || (C_DYNREC)
MAPPER_AddHandler(CPU_ToggleDynamicCore,MK_nothing,0,"dynamic","DynCore",&item);
MAPPER_AddHandler(CPU_ToggleDynamicCore,MK_nothing,0,"dynamic","DynaCore",&item);
item->set_text("Dynamic core");
#endif
#if !defined(C_EMSCRIPTEN)
@@ -3374,14 +3408,15 @@ public:
cpudecoder=&CPU_Core_Normal_Run;
CPU_AutoDetermineMode|=CPU_AUTODETERMINE_CORE;
#if (C_DYNAMIC_X86)
} else if (core == "dynamic") {
} else if ((core == "dynamic" && GetDynamicType()==1) || core == "dynamic_x86") {
cpudecoder=&CPU_Core_Dyn_X86_Run;
CPU_Core_Dyn_X86_SetFPUMode(true);
} else if (core == "dynamic_nodhfpu") {
cpudecoder=&CPU_Core_Dyn_X86_Run;
CPU_Core_Dyn_X86_SetFPUMode(false);
#elif (C_DYNREC)
} else if (core == "dynamic") {
#endif
#if (C_DYNREC)
} else if ((core == "dynamic" && GetDynamicType()==2) || core == "dynamic_rec") {
cpudecoder=&CPU_Core_Dynrec_Run;
#endif
} else {
@@ -3391,9 +3426,10 @@ public:
}
#if (C_DYNAMIC_X86)
CPU_Core_Dyn_X86_Cache_Init((core == "dynamic") || (core == "dynamic_nodhfpu"));
#elif (C_DYNREC)
CPU_Core_Dynrec_Cache_Init( core == "dynamic" );
CPU_Core_Dyn_X86_Cache_Init((core == "dynamic" && GetDynamicType()==1) || (core == "dynamic_x86") || (core == "dynamic_nodhfpu"));
#endif
#if (C_DYNREC)
CPU_Core_Dynrec_Cache_Init((core == "dynamic" && GetDynamicType()==2) || (core == "dynamic_rec"));
#endif
CPU_ArchitectureType = CPU_ARCHTYPE_MIXED;
@@ -3615,7 +3651,8 @@ void CPU_ShutDown(Section* sec) {
#if (C_DYNAMIC_X86)
CPU_Core_Dyn_X86_Cache_Close();
#elif (C_DYNREC)
#endif
#if (C_DYNREC)
CPU_Core_Dynrec_Cache_Close();
#endif
delete test;
@@ -4122,7 +4159,8 @@ virtual void setBytes(std::istream& stream)
}
#if (C_DYNAMIC_X86)
CPU_Core_Dyn_X86_Cache_Reset();
#elif (C_DYNREC)
#endif
#if (C_DYNREC)
CPU_Core_Dynrec_Cache_Reset();
#endif
}

View File

@@ -1342,8 +1342,11 @@ void DOSBOX_SetupConfigSections(void) {
0 };
const char* cores[] = { "auto",
#if (C_DYNAMIC_X86) || (C_DYNREC)
"dynamic",
#if (C_DYNAMIC_X86)
"dynamic", "dynamic_x86", "dynamic_nodhfpu",
#endif
#if (C_DYNREC)
"dynamic", "dynamic_rec",
#endif
"normal", "full", "simple", 0 };
@@ -2294,8 +2297,9 @@ void DOSBOX_SetupConfigSections(void) {
Pstring = secprop->Add_string("core",Property::Changeable::WhenIdle,"auto");
Pstring->Set_values(cores);
Pstring->Set_help("CPU Core used in emulation. auto will switch to dynamic if available and appropriate.\n"
"WARNING: Do not use dynamic or auto setting core with Windows 95 or other preemptive\n"
"multitasking OSes with protected mode paging, you should use the normal core instead.");
"For the dynamic core, both dynamic_x86 and dynamic_rec are supported (dynamic_x86 is preferred).\n"
"Windows 95 or other preemptive multitasking OSes will not work with the dynamic_rec core.");
Pstring->SetBasic(true);
Pbool = secprop->Add_bool("fpu",Property::Changeable::Always,true);

View File

@@ -78,7 +78,7 @@
# define C_TARGETCPU X86_64
/* Define to 1 to use x86 dynamic cpu core */
# define C_DYNAMIC_X86 1
# undef C_DYNREC
# define C_DYNREC 1
#elif defined (_M_ARM64) || defined (_M_ARM) /* Microsoft C++ amd64, arm32 and arm64 */
# undef C_TARGETCPU
# undef C_DYNAMIC_X86
@@ -86,7 +86,7 @@
#else
# define C_TARGETCPU X86
# define C_DYNAMIC_X86 1
# undef C_DYNREC
# define C_DYNREC 1
#endif
/* Define to 1 to enable fluidsynth MIDI synthesis */