CPUID: Fix Pentium III CPUID values and implement CPUID Processor Configuration Descriptors, which is apparently required by Windows XP to boot without hanging when emulating a Pentium III

This commit is contained in:
Jonathan Campbell 2024-12-28 18:13:13 -08:00
parent 24eec4f721
commit 8d80831e7f
2 changed files with 27 additions and 2 deletions

View File

@ -1,4 +1,12 @@
Next
- Correct CPUID family/model/brand values for cputype=pentium_iii.
Add CPUID level 2, which returns "processor configuration
descriptors", and return documented Pentium III values. Apparently
Windows XP really REALLY cares about these configuration
descriptors and will hang in-kernel in an infinite loop at bootup
without these apparently really important values. This change
makes it possible to boot Windows XP with Pentium III emulation.
(joncampbell123).
- Allow values of memsize to represent 4GB or more of RAM. Up to
1TB, if Pentium PSE extensions are enabled, the memalias setting
is 40, and "enable pse=pse40" in the conf file. Memalias maximum

View File

@ -3140,8 +3140,8 @@ bool CPU_CPUID(void) {
if (enable_cmpxchg8b) reg_edx |= 0x100; /* CMPXCHG8B */
reg_edx |= 0x800; /* SEP Fast System Call aka SYSENTER/SYSEXIT [SEE NOTES AT TOP OF THIS IF STATEMENT] */
} else if (CPU_ArchitectureType == CPU_ARCHTYPE_PENTIUMIII || CPU_ArchitectureType == CPU_ARCHTYPE_EXPERIMENTAL) {
reg_eax=0x673; /* intel pentium III */
reg_ebx=0; /* Not Supported */
reg_eax=0x643; /* intel pentium III */
reg_ebx=0x0002; /* brand */
reg_ecx=0; /* No features */
reg_edx=0x03808011; /* FPU+TimeStamp/RDTSC+SSE+FXSAVE/FXRESTOR */
if (enable_msr) reg_edx |= 0x20; /* ModelSpecific/MSR */
@ -3152,6 +3152,23 @@ bool CPU_CPUID(void) {
reg_edx |= 0x800; /* SEP Fast System Call aka SYSENTER/SYSEXIT */
}
break;
case 2: /* Processor Configuration Descriptor(s) */
if (CPU_ArchitectureType == CPU_ARCHTYPE_PENTIUMIII) {
/* NTS: Windows XP considers these values SOOOOO IMPORTANT that if we don't return any here
* the NT kernel will just spin endlessly in an infinite loop with interrupts disabled
* instead of, you know, booting up. But only if it sees a Pentium III. */
reg_eax=0x00004301; /* AL=1 desc 43h */
reg_ebx=0x00000000;
reg_ecx=0x00000000;
reg_edx=0x00000000;
}
else {
reg_eax=0x00000000;
reg_ebx=0x00000000;
reg_ecx=0x00000000;
reg_edx=0x00000000;
}
break;
case 3: /* Processor Serial Number */
if (CPU_ArchitectureType == CPU_ARCHTYPE_PENTIUMIII && p3psn.enabled) {
reg_eax = 0;