Differences From Artifact [3f56016e9e]:
- File src/OFSystemInfo.m — part of check-in [cbc09c6e26] at 2020-09-27 00:57:30 on branch trunk — Work around bugs in Apple GCC 4.2.1 (user: js, size: 15992) [annotate] [blame] [check-ins using] [more...]
To Artifact [97e07274dd]:
- File
src/OFSystemInfo.m
— part of check-in
[e73d0702d0]
at
2020-11-02 01:11:34
on branch trunk
— OFSystemInfo: Do not use sysctl to get CPU vendor
The sysctl name is specific to x86 on macOS and NetBSD, so cannot be
used for other architectures and the CPU vendor on x86 can just be
obtained via cpuid. (user: js, size: 15997) [annotate] [blame] [check-ins using] [more...]
| ︙ | ︙ | |||
530 531 532 533 534 535 536 |
}
#endif
+ (OFString *)CPUVendor
{
#if defined(OF_X86_64_ASM) || defined(OF_X86_ASM)
struct x86_regs regs = x86_cpuid(0, 0);
| | | | | | | | | | | | | | | | > | > | | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
}
#endif
+ (OFString *)CPUVendor
{
#if defined(OF_X86_64_ASM) || defined(OF_X86_ASM)
struct x86_regs regs = x86_cpuid(0, 0);
uint32_t buffer[3];
if (regs.eax == 0)
return nil;
buffer[0] = regs.ebx;
buffer[1] = regs.edx;
buffer[2] = regs.ecx;
return [OFString stringWithCString: (char *)buffer
encoding: OF_STRING_ENCODING_ASCII
length: 12];
#else
return nil;
#endif
}
+ (OFString *)CPUModel
{
#if defined(OF_X86_64_ASM) || defined(OF_X86_ASM)
uint32_t buffer[12];
size_t i;
i = 0;
for (uint32_t eax = 0x80000002; eax <= 0x80000004; eax++) {
struct x86_regs regs = x86_cpuid(eax, 0);
buffer[i++] = regs.eax;
buffer[i++] = regs.ebx;
buffer[i++] = regs.ecx;
buffer[i++] = regs.edx;
}
return [OFString stringWithCString: (char *)buffer
encoding: OF_STRING_ENCODING_ASCII];
#elif defined(OF_AMIGAOS4)
CONST_STRPTR model, version;
GetCPUInfoTags(GCIT_ModelString, &model,
GCIT_VersionString, &version, TAG_END);
|
| ︙ | ︙ |