ObjFW  Check-in [dec757bcc1]

Overview
Comment:Only return CPUModel if cpuid supports it
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: dec757bcc1eeea3de1265602c9461f6788e0041bac22857084b6a88277c08e93
User & Date: js on 2021-12-22 20:39:26
Other Links: manifest | tags
Context
2021-12-24
11:06
OFMapTable: Fix rotating with the wrong size check-in: ae4879fe0d user: js tags: trunk
2021-12-22
20:39
Only return CPUModel if cpuid supports it check-in: dec757bcc1 user: js tags: trunk
02:12
Implement -[temporaryDirectoryPath] for MS-DOS check-in: fca07c0c1b user: js tags: trunk
Changes

Modified src/OFSystemInfo.m from [95caf6d60f] to [898b4a7065].

600
601
602
603
604
605
606

607
608
609



610
611
612
613
614
615
616
617
618
619
620
	return nil;
#endif
}

+ (OFString *)CPUModel
{
#if (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__)

	uint32_t buffer[12];
	size_t i;




	i = 0;
	for (uint32_t eax = 0x80000002; eax <= 0x80000004; eax++) {
		struct X86Regs regs = x86CPUID(eax, 0);

		buffer[i++] = regs.eax;
		buffer[i++] = regs.ebx;
		buffer[i++] = regs.ecx;
		buffer[i++] = regs.edx;
	}

	return [OFString stringWithCString: (char *)buffer







>



>
>
>


|
<







600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616

617
618
619
620
621
622
623
	return nil;
#endif
}

+ (OFString *)CPUModel
{
#if (defined(OF_X86_64) || defined(OF_X86)) && defined(__GNUC__)
	struct X86Regs regs = x86CPUID(0x80000000, 0);
	uint32_t buffer[12];
	size_t i;

	if (regs.eax < 0x80000004)
		return nil;

	i = 0;
	for (uint32_t eax = 0x80000002; eax <= 0x80000004; eax++) {
		regs = x86CPUID(eax, 0);

		buffer[i++] = regs.eax;
		buffer[i++] = regs.ebx;
		buffer[i++] = regs.ecx;
		buffer[i++] = regs.edx;
	}

	return [OFString stringWithCString: (char *)buffer