wineboot: More architectures and vendorIDs
K. Wartke
kwartke at gmail.com
Sun Aug 22 05:38:58 CDT 2010
---
programs/wineboot/wineboot.c | 57 ++++++++++++++++++++++++++++++++++++------
1 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 90dd779..d9ffaa0 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -176,24 +176,42 @@ static void create_hardware_registry_keys(void)
static const WCHAR IdentifierW[] = {'I','d','e','n','t','i','f','i','e','r',0};
static const WCHAR SysidW[] = {'A','T',' ','c','o','m','p','a','t','i','b','l','e',0};
static const WCHAR mhzKeyW[] = {'~','M','H','z',0};
+ static const WCHAR x86W[] = {'x','8','6',0};
+ static const WCHAR IA64W[] = {'I','A','6','4',0};
+ static const WCHAR AMD64W[] = {'A','M','D','6','4',0};
static const WCHAR VendorIdentifierW[] = {'V','e','n','d','o','r','I','d','e','n','t','i','f','i','e','r',0};
- static const WCHAR VenidIntelW[] = {'G','e','n','u','i','n','e','I','n','t','e','l',0};
- /* static const WCHAR VenidAMDW[] = {'A','u','t','h','e','n','t','i','c','A','M','D',0}; */
static const WCHAR PercentDW[] = {'%','d',0};
- static const WCHAR IntelCpuDescrW[] = {'x','8','6',' ','F','a','m','i','l','y',' ','%','d',' ','M','o','d','e','l',' ','%','d',
+ static const WCHAR PercentSW[] = {'%','s',0};
+ static const WCHAR CpuDescrW[] = {'%','s',' ','F','a','m','i','l','y',' ','%','d',' ','M','o','d','e','l',' ','%','d',
' ','S','t','e','p','p','i','n','g',' ','%','d',0};
unsigned int i;
+ unsigned int regs[3];
HKEY hkey, system_key, cpu_key, fpu_key;
SYSTEM_CPU_INFORMATION sci;
PROCESSOR_POWER_INFORMATION power_info;
WCHAR idW[60];
+ WCHAR Arch[6];
+ WCHAR VendorIDW[13];
NtQuerySystemInformation( SystemCpuInformation, &sci, sizeof(sci), NULL );
if (NtPowerInformation(ProcessorInformation, NULL, 0, &power_info, sizeof(power_info)))
power_info.MaxMhz = 0;
- /*TODO: report 64bit processors properly*/
- sprintfW( idW, IntelCpuDescrW, sci.Level, HIBYTE(sci.Revision), LOBYTE(sci.Revision) );
+ switch(sci.Architecture)
+ {
+ case PROCESSOR_ARCHITECTURE_AMD64:
+ sprintfW(Arch, PercentSW, AMD64W);
+ break;
+ case PROCESSOR_ARCHITECTURE_IA64:
+ sprintfW(Arch, PercentSW, IA64W );
+ break;
+ case PROCESSOR_ARCHITECTURE_INTEL:
+ default:
+ sprintfW(Arch, PercentSW, x86W );
+ break;
+ }
+
+ sprintfW( idW, CpuDescrW, Arch, sci.Level, HIBYTE(sci.Revision), LOBYTE(sci.Revision) );
if (RegCreateKeyExW( HKEY_LOCAL_MACHINE, SystemW, 0, NULL, REG_OPTION_VOLATILE,
KEY_ALL_ACCESS, NULL, &system_key, NULL ))
@@ -207,18 +225,41 @@ static void create_hardware_registry_keys(void)
if (RegCreateKeyExW( system_key, cpuW, 0, NULL, REG_OPTION_VOLATILE,
KEY_ALL_ACCESS, NULL, &cpu_key, NULL ))
cpu_key = 0;
+
+#ifdef __i386__
+ /* get VendorID from CPUID, eax = 0 */
+ i = 0;
+ __asm__("movl $0, %%eax\n\t"
+ "pushl %%ebx\n\t"
+ "cpuid\n\t"
+ "movl %%ebx, %%esi\n\t"
+ "popl %%ebx"
+ : "=S" (regs[0]), "=d" (regs[1]), "=c" (regs[2])); /* string is in eax, edx, ecx (in that order) */
+ for(i = 0; i < 4; i++)
+ {
+ VendorIDW[i] = (WCHAR)regs[0] & 0xff;
+ VendorIDW[i + 4] = (WCHAR)regs[1] & 0xff;
+ VendorIDW[i + 8] = (WCHAR)regs[2] & 0xff;
+ regs[0] = regs[0] >> 8;
+ regs[1] = regs[1] >> 8;
+ regs[2] = regs[2] >> 8;
+ }
+ VendorIDW[12] = '\0';
+#else
+ static const WCHAR VenidIntelW[] = {'G','e','n','u','i','n','e','I','n','t','e','l',0};
+ sprintfW( VendorIDW, PercentSW, VenidIntelW); /* TODO: currently hardcoded Intel on non-i386 */
+#endif
for (i = 0; i < NtCurrentTeb()->Peb->NumberOfProcessors; i++)
{
WCHAR numW[10];
-
+
sprintfW( numW, PercentDW, i );
if (!RegCreateKeyExW( cpu_key, numW, 0, NULL, REG_OPTION_VOLATILE,
KEY_ALL_ACCESS, NULL, &hkey, NULL ))
{
set_reg_value( hkey, IdentifierW, idW );
- /*TODO; report amd's properly*/
- set_reg_value( hkey, VendorIdentifierW, VenidIntelW );
+ set_reg_value( hkey, VendorIdentifierW, VendorIDW );
RegSetValueExW( hkey, mhzKeyW, 0, REG_DWORD, (BYTE *)&power_info.MaxMhz, sizeof(DWORD) );
RegCloseKey( hkey );
}
--
1.7.1
------------B9L9O1DC5qkEe1zTzgJ2Ye--
More information about the wine-patches
mailing list