ObjFW  Check-in [9903dedecb]

Overview
Comment:OFSystemInfo: Minor cleanup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9903dedecba0fe45d2865e69a90c27446bcb87e1cf8df45eb04b0aaa525e94f3
User & Date: js on 2020-11-02 00:56:47
Other Links: manifest | tags
Context
2020-11-02
01:11
OFSystemInfo: Do not use sysctl to get CPU vendor check-in: e73d0702d0 user: js tags: trunk
00:56
OFSystemInfo: Minor cleanup check-in: 9903dedecb user: js tags: trunk
00:53
OFSystemInfo: Use cpuid to get CPU model check-in: acb2130974 user: js tags: trunk
Changes

Modified src/OFSystemInfo.m from [3a242f30a6] to [a8432f0c63].

530
531
532
533
534
535
536
537

538
539
540
541
542
543
544



545
546

547
548
549
550
551
552
553
530
531
532
533
534
535
536

537
538
539
540
541



542
543
544
545

546
547
548
549
550
551
552
553







-
+




-
-
-
+
+
+

-
+







}
#endif

+ (OFString *)CPUVendor
{
#if defined(OF_X86_64_ASM) || defined(OF_X86_ASM)
	struct x86_regs regs = x86_cpuid(0, 0);
	char buffer[12];
	uint32_t buffer[3];

	if (regs.eax == 0)
		return nil;

	memcpy(buffer, &regs.ebx, 4);
	memcpy(buffer + 4, &regs.edx, 4);
	memcpy(buffer + 8, &regs.ecx, 4);
	buffer[0] = regs.ebx;
	buffer[1] = regs.edx;
	buffer[2] = regs.ecx;

	return [OFString stringWithCString: buffer
	return [OFString stringWithCString: (char *)buffer
				  encoding: OF_STRING_ENCODING_ASCII
				    length: 12];
#else
	return nil;
#endif
}